From 8199b48ae5d31b008f10dff173352bd8ba2d8890 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Wed, 5 Feb 2025 23:04:13 +0100 Subject: Enhance admin view by sitemap --- public/javascripts/admin_interface.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'public/javascripts/admin_interface.js') diff --git a/public/javascripts/admin_interface.js b/public/javascripts/admin_interface.js index f8148e2..ea3ab3d 100644 --- a/public/javascripts/admin_interface.js +++ b/public/javascripts/admin_interface.js @@ -16,7 +16,7 @@ $(document).ready(function () { theme_advanced_buttons1 : "bold, italic, underline, bullist, numlist, link, unlink, formatselect, code", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", - extended_valid_elements : "aggregate[tags|limit|order_by|order_direction|partial]", + extended_valid_elements : "aggregate[tags|limit|order_by|order_direction|partial|conditions]", relative_urls : false, entity_encoding : "raw", oninit : cccms.setup_autosave() @@ -44,21 +44,36 @@ $(document).ready(function () { if ($('#recent_changes_toggle').length != 0) { $('#current_drafts_table').hide(); + $('#admin_sitemap_table').hide(); $('#recent_changes_toggle').attr("class", "selected"); $('#recent_changes_toggle').bind("click", function(){ $('#recent_changes_toggle').attr("class", "selected"); $('#current_drafts_toggle').attr("class", "unselected"); + $('#admin_sitemap_toggle').attr("class", "unselected"); $('#recent_changes_table').show(); $('#current_drafts_table').hide(); + $('#admin_sitemap_table').hide(); return false; }); $('#current_drafts_toggle').bind("click", function(){ $('#recent_changes_toggle').attr("class", "unselected"); $('#current_drafts_toggle').attr("class", "selected"); + $('#admin_sitemap_toggle').attr("class", "unselected"); $('#current_drafts_table').show(); $('#recent_changes_table').hide(); + $('#admin_sitemap_table').hide(); + return false; + }); + + $('#admin_sitemap_toggle').bind("click", function(){ + $('#recent_changes_toggle').attr("class", "unselected"); + $('#current_drafts_toggle').attr("class", "unselected"); + $('#admin_sitemap_toggle').attr("class", "selected"); + $('#current_drafts_table').hide(); + $('#recent_changes_table').hide(); + $('#admin_sitemap_table').show(); return false; }); } -- cgit v1.3 From 375ed745052148faeb34763087fe04214105f1b8 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Thu, 6 Feb 2025 16:49:06 +0100 Subject: Improve worklflow --- app/controllers/admin_controller.rb | 18 ++++++++++-- app/controllers/nodes_controller.rb | 15 +++++++++- app/views/admin/index.html.erb | 48 ++++++++++++++++++++++++++++++-- app/views/nodes/new.html.erb | 12 +++++--- public/javascripts/admin_interface.js | 52 +++++++++++++++++++++++++---------- public/javascripts/admin_search.js | 4 +++ public/stylesheets/admin.css | 16 +++++++++++ 7 files changed, 141 insertions(+), 24 deletions(-) (limited to 'public/javascripts/admin_interface.js') diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 7c1375a..f3cc221 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -6,12 +6,15 @@ class AdminController < ApplicationController def index @drafts = Node.all( - :limit => 20, + :limit => 50, :order => "updated_at desc", :conditions => ["draft_id IS NOT NULL"] ) + @drafts_count = Node.count( + :conditions => ["draft_id IS NOT NULL"] + ) @recent_changes = Node.all( - :limit => 20, + :limit => 50, :order => "updated_at desc", :conditions => [ "updated_at < ? AND updated_at > ? AND parent_id IS NOT NULL", Time.now, Time.now-14.days @@ -24,6 +27,17 @@ class AdminController < ApplicationController @sitemap_depth[node.id] = level end @sitemap = all_nodes.to_a.sort! { |node1,node2| node1.lft <=> node2.lft }.delete_if { |node| node.update? } + + @mypages = Page.all( + :conditions => [ "user_id = ? or editor_id = ?", @current_user, @current_user] + ) + + @mynodes = Node.all( + :order => "updated_at desc", + :joins => :pages, + :conditions => [ "pages.user_id = ? or pages.editor_id = ?", @current_user, @current_user ] + ).uniq.first(50) + end def search diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index 4f72744..b8cd644 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb @@ -25,6 +25,10 @@ class NodesController < ApplicationController def new @node = Node.new params[:node] + if params.has_key?(:parent_id) + @parent_id = params[:parent_id] + @parent_name = Node.find(@parent_id).title + end end def create @@ -33,9 +37,16 @@ class NodesController < ApplicationController @node = Node.new @node.parent_id = find_parent @node.slug = params[:title].parameterize.to_s - + if @node.save @node.draft.update_attributes(:title => params[:title]) + case params[:kind] + when "update" + @node.draft.tag_list.add("update") + when "press_release" + @node.draft.tag_list.add("update", "pressemitteilung") + end + @node.draft.save! redirect_to(edit_node_path(@node)) else render :new @@ -107,6 +118,8 @@ class NodesController < ApplicationController Node.root.id when "update" Update.find_or_create_parent.id + when "press_release" + Update.find_or_create_parent.id when "generic" if params[:parent_id] && Node.find(params[:parent_id]) params[:parent_id] diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb index 8c8271f..edad1d6 100644 --- a/app/views/admin/index.html.erb +++ b/app/views/admin/index.html.erb @@ -1,5 +1,13 @@ +
+ <%= link_to 'Create Update or Pressemitteilung', new_node_path, :only_path => false %> + Continue my work + Add a page in the page tree + <%= link_to("Upload a new asset", new_asset_path, :only_path => false) %> +
+

recent changes + my work current drafts site map

@@ -38,9 +46,43 @@ +
+ +

My Work

+ + + + + + + + + + <% @mynodes.each do |node| %> + "> + + + + + + + <% end %> +
IDTitleActionsLocked byRev.
<%= node.id %> +

<%= link_to title_for_node(node), node_path(node) %>

+

<%= link_to_path(node.unique_name, node.unique_name) %>

+
+ <%= link_to 'show', node_path(node) %> + <%= link_to 'Revisions', node_revisions_path(node) %> + + <%= node.lock_owner.login if node.lock_owner %> + + <%= node.draft ? node.draft.revision : node.head.revision %> +
+
+
-

Current Drafts

+

Current Drafts (<%= @drafts_count %>)

@@ -92,8 +134,8 @@

<%= link_to_path(node.unique_name, node.unique_name) %>

@@ -31,8 +35,8 @@
- <%= link_to 'show', node_path(node) %> - <%= link_to 'Revisions', node_revisions_path(node) %> + <%= link_to 'create subpage', new_node_path(:parent_id => node.id) %> + <%= link_to ':: Revisions', node_revisions_path(node) %> <%= node.lock_owner.login if node.lock_owner %> diff --git a/app/views/nodes/new.html.erb b/app/views/nodes/new.html.erb index 850207b..7d744de 100644 --- a/app/views/nodes/new.html.erb +++ b/app/views/nodes/new.html.erb @@ -20,7 +20,11 @@

<%= radio_button_tag :kind, "update" %> - Update / Press release ( is automatically created in /updates ) + Update ( is automatically created in /updates/<%= Time.now.year.to_s %>/ and gets tag "update" ) +

+

+ <%= radio_button_tag :kind, "press_release" %> + Pressemitteilung ( is automatically created in /updates/<%= Time.now.year.to_s %>/ and gets tags "update, pressemitteilung" )

Parent - <%= text_field_tag :parent_search_term %> - <%= hidden_field_tag :parent_id %> + <%= text_field_tag :parent_search_term, @parent_name %> + <%= hidden_field_tag :parent_id, @parent_id %>
@@ -43,4 +47,4 @@
<%= submit_tag "Create" %>
-<% end %> \ No newline at end of file +<% end %> diff --git a/public/javascripts/admin_interface.js b/public/javascripts/admin_interface.js index ea3ab3d..aacb6f8 100644 --- a/public/javascripts/admin_interface.js +++ b/public/javascripts/admin_interface.js @@ -1,3 +1,15 @@ +function hide_all() { + $('#recent_changes_toggle').attr("class", "unselected"); + $('#my_work_toggle').attr("class", "unselected"); + $('#current_drafts_toggle').attr("class", "unselected"); + $('#admin_sitemap_toggle').attr("class", "unselected"); + + $('#current_drafts_table').hide(); + $('#my_work_table').hide(); + $('#recent_changes_table').hide(); + $('#admin_sitemap_table').hide(); +} + $(document).ready(function () { admin_search.initialize(); @@ -43,36 +55,48 @@ $(document).ready(function () { } if ($('#recent_changes_toggle').length != 0) { - $('#current_drafts_table').hide(); - $('#admin_sitemap_table').hide(); + hide_all(); $('#recent_changes_toggle').attr("class", "selected"); + $('#recent_changes_table').show(); $('#recent_changes_toggle').bind("click", function(){ + hide_all(); $('#recent_changes_toggle').attr("class", "selected"); - $('#current_drafts_toggle').attr("class", "unselected"); - $('#admin_sitemap_toggle').attr("class", "unselected"); $('#recent_changes_table').show(); - $('#current_drafts_table').hide(); - $('#admin_sitemap_table').hide(); + return false; + }); + + $('#my_work_toggle').bind("click", function(){ + hide_all(); + $('#my_work_toggle').attr("class", "selected"); + $('#my_work_table').show(); + return false; + }); + + $('#admin_wizard_my_work').bind("click", function(){ + hide_all(); + $('#my_work_toggle').attr("class", "selected"); + $('#my_work_table').show(); return false; }); $('#current_drafts_toggle').bind("click", function(){ - $('#recent_changes_toggle').attr("class", "unselected"); + hide_all(); $('#current_drafts_toggle').attr("class", "selected"); - $('#admin_sitemap_toggle').attr("class", "unselected"); $('#current_drafts_table').show(); - $('#recent_changes_table').hide(); - $('#admin_sitemap_table').hide(); return false; }); $('#admin_sitemap_toggle').bind("click", function(){ - $('#recent_changes_toggle').attr("class", "unselected"); - $('#current_drafts_toggle').attr("class", "unselected"); + hide_all(); + $('#admin_sitemap_toggle').attr("class", "selected"); + $('#admin_sitemap_table').show(); + return false; + }); + + $('#admin_wizard_create_page').bind("click", function(){ + hide_all(); $('#admin_sitemap_toggle').attr("class", "selected"); - $('#current_drafts_table').hide(); - $('#recent_changes_table').hide(); $('#admin_sitemap_table').show(); return false; }); diff --git a/public/javascripts/admin_search.js b/public/javascripts/admin_search.js index 98571de..78577e7 100644 --- a/public/javascripts/admin_search.js +++ b/public/javascripts/admin_search.js @@ -160,6 +160,10 @@ parent_search = { $("#parent_search_field").hide(); }); + $("#kind_press_release").bind("change", function(){ + $("#parent_search_field").hide(); + }); + $("#kind_generic").bind("change", function(){ $("#parent_search_field").show(); }); diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index fbb8a3f..c7ebb52 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css @@ -106,6 +106,22 @@ input[type=submit], text-transform: lowercase; } +#admin_wizard { + margin-bottom: 2rem; +} + +#admin_wizard a { + font-size: 1rem; + font-weight: bold; + padding: 0.5rem; + background-color: green; + color: white; +} + +#admin_wizard a:hover { + background-color: lime; +} + #sub_navigation a { color: #969696; } -- cgit v1.3 From 420506e58fdfc84f1a5bede0a01dedf0af3bb4f3 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 27 Jun 2026 16:58:53 +0200 Subject: Stage 7: Rails 7.2 → 8.1 on Ruby 3.2.11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Bump Rails to 8.1.3 (Ruby unchanged at 3.2.11, new gemset rails8-upgrade) - config.load_defaults 8.1; merge app:update diffs for all environment files - Remove routing-filter 0.7.0; replace with native scope '(:locale)' in routes.rb and default_url_options in ApplicationController - Delete config/initializers/routing_filter_rails71_patch.rb - Replace vendored TinyMCE 3.x (~200 files) with tinymce-rails ~> 8.3; migrate admin_interface.js from jQuery .tinymce()/advanced theme to tinymce.init(); add config/tinymce.yml; note: TinyMCE 7+ is GPL - rails-i18n ~> 8.0 added explicitly (previously indirect dependency) - awesome_nested_set, acts-as-taggable-on pinned to git main/master (gemspec activerecord < 8.1 ceiling; no functional incompatibility; repin to version once upstream releases updated gemspecs) - globalize ~> 7.0, libxml-ruby ~> 5.0, nokogiri ~> 1.18, pg ~> 1.5 - sass-rails, coffee-rails, uglifier moved from :assets group to main (Sprockets 4 convention; :assets group no longer meaningful) - Node: head, draft, lock_owner marked belongs_to optional: true - Page: node, user, editor marked belongs_to optional: true - Static assets in public/images/ and public/javascripts/ referenced via plain HTML tags; Rails 8 load_defaults raises on pipeline helpers for undeclared assets - sessions_controller_test.rb: remove stale require and dead rescue_action - users_controller_test.rb: assert button[type=submit] not input[type=submit] (Rails 8 button_to renders