diff --git a/Gemfile.lock b/Gemfile.lock index af354db..06705fd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,6 +2,7 @@ PATH remote: . specs: merged (0.1.0) + git haml-rails rails (>= 7.0.4) @@ -73,11 +74,16 @@ GEM i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) builder (3.2.4) concurrent-ruby (1.1.10) crass (1.0.6) diff-lcs (1.5.0) erubi (1.11.0) + git (1.12.0) + addressable (~> 2.8) + rchardet (~> 1.8) globalid (1.0.0) activesupport (>= 5.0) haml (6.0.12) @@ -111,6 +117,7 @@ GEM nio4r (2.5.8) nokogiri (1.13.9-x86_64-linux) racc (~> 1.4) + public_suffix (5.0.0) racc (1.6.0) rack (2.2.4) rack-test (2.0.2) @@ -142,6 +149,7 @@ GEM thor (~> 1.0) zeitwerk (~> 2.5) rake (13.0.6) + rchardet (1.8.0) rspec-core (3.12.0) rspec-support (~> 3.12.0) rspec-expectations (3.12.0) diff --git a/app/controllers/merged/changes_controller.rb b/app/controllers/merged/changes_controller.rb new file mode 100644 index 0000000..4424113 --- /dev/null +++ b/app/controllers/merged/changes_controller.rb @@ -0,0 +1,11 @@ +require "rugged" + +module Merged + class ChangesController < MergedController + + def index + @git = Rugged::Repository.new(Rails.root) + end + + end +end diff --git a/app/helpers/merged/changes_helper.rb b/app/helpers/merged/changes_helper.rb new file mode 100644 index 0000000..f5a0941 --- /dev/null +++ b/app/helpers/merged/changes_helper.rb @@ -0,0 +1,4 @@ +module Merged + module ChangesHelper + end +end diff --git a/app/views/layouts/merged/application.html.erb b/app/views/layouts/merged/application.html.erb deleted file mode 100644 index f25096c..0000000 --- a/app/views/layouts/merged/application.html.erb +++ /dev/null @@ -1,15 +0,0 @@ - - - - Merged - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - - <%= stylesheet_link_tag "merged/application", media: "all" %> - - - -<%= yield %> - - - diff --git a/app/views/layouts/merged_layout.haml b/app/views/layouts/merged_layout.haml index 99a9378..03a8858 100644 --- a/app/views/layouts/merged_layout.haml +++ b/app/views/layouts/merged_layout.haml @@ -2,7 +2,7 @@ %html %head %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/ - %title Gateway + %title Merged CMS %meta{:content => "width=device-width,initial-scale=1", :name => "viewport"}/ = csrf_meta_tags = csp_meta_tag @@ -32,7 +32,7 @@ %a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => styles_index_path} Styles %li - %a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => "/changes"} + %a.text-gray-500.transition{:class => "hover:text-gray-500/75", :href => changes_index_path} Changes .flex.items-center.gap-4 .sm:flex.sm:gap-4 diff --git a/app/views/merged/changes/index.haml b/app/views/merged/changes/index.haml new file mode 100644 index 0000000..784a2d7 --- /dev/null +++ b/app/views/merged/changes/index.haml @@ -0,0 +1,13 @@ +%p= @git.workdir +%p Lines Changed +-@git.diff_workdir("HEAD").each_line do |line| + %p= line.content +%h3 Patches +%h3 Patches +%h3 Patches +-@git.diff_workdir("HEAD").each_patch do |patch| + %p= patch.additions + -patch.each_hunk do |hunk| + %p=hunk.header + -hunk.each_line do |line| + %p= line.content diff --git a/app/views/merged/sections/show.html.haml b/app/views/merged/sections/show.html.haml index 77bb087..6dd5144 100644 --- a/app/views/merged/sections/show.html.haml +++ b/app/views/merged/sections/show.html.haml @@ -49,7 +49,7 @@ %h3.mt-4.text-lg.font-bold #{@section.cards.length} Cards -@section.cards.each do |card| .mt-4.text-md.font-bold= card.header - .text-sm "#{card.text[0..70]} ....." + .text-sm #{card.text[0..70]} ..... %p.p-3 = yellow_button( "View and Edit Cards" , section_cards_url(@section.id)) = green_button( "New Card" , new_section_card_url(@section.id) ) diff --git a/config/routes.rb b/config/routes.rb index c099332..7e02f00 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,8 @@ Merged::Engine.routes.draw do - get "/styles/index" , to: "styles#index" + get 'changes/index' + get "styles/index" + resources :pages , except: [:show] , shallow: true do resources :sections do get :select_image diff --git a/merged.gemspec b/merged.gemspec index 636e2d9..6dbe7ae 100644 --- a/merged.gemspec +++ b/merged.gemspec @@ -20,4 +20,5 @@ Gem::Specification.new do |spec| spec.add_dependency "rails", ">= 7.0.4" spec.add_dependency "haml-rails" + spec.add_dependency "rugged" end