From a15e34dbc4dd0a974172619095d74c321f0e3812 Mon Sep 17 00:00:00 2001 From: hukl Date: Tue, 3 Apr 2012 20:57:09 +0200 Subject: added footer image --- public/images/footer.png | Bin 0 -> 6566 bytes public/stylesheets/ccc.css | 10 +++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 public/images/footer.png diff --git a/public/images/footer.png b/public/images/footer.png new file mode 100644 index 0000000..dab5f8d Binary files /dev/null and b/public/images/footer.png differ diff --git a/public/stylesheets/ccc.css b/public/stylesheets/ccc.css index c58e3ae..02690e8 100644 --- a/public/stylesheets/ccc.css +++ b/public/stylesheets/ccc.css @@ -194,7 +194,7 @@ div#center_column { width: 460px; padding-left: 15px; padding-right: 15px; - padding-bottom: 40px; + padding-bottom: 0px; } div#right_column { @@ -254,4 +254,12 @@ div#search input[type=text] { padding-right: 5px; margin-right: 5px; background-position: top top; +} + +div#footer { + width: 1024px; + height: 240px; + margin-left: -304px; + background-image: url(/images/footer.png); + background-repeat: no-repeat; } \ No newline at end of file -- cgit v1.3 From e3ceffa0a53c9e85739a1fd376d30e575a35f302 Mon Sep 17 00:00:00 2001 From: hukl Date: Tue, 3 Apr 2012 21:12:20 +0200 Subject: added quote --- app/views/layouts/application.html.erb | 3 +++ public/stylesheets/ccc.css | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 3c95d75..8965922 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -43,6 +43,9 @@

<%= link_to t(:sponsors), content_path("sponsors") %>

+

+ »They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.« Benjamin Franklin +

diff --git a/public/stylesheets/ccc.css b/public/stylesheets/ccc.css index 02690e8..bd6001d 100644 --- a/public/stylesheets/ccc.css +++ b/public/stylesheets/ccc.css @@ -257,9 +257,17 @@ div#search input[type=text] { } div#footer { + position: relative; width: 1024px; height: 240px; margin-left: -304px; background-image: url(/images/footer.png); background-repeat: no-repeat; +} + +p#quote { + position: absolute; + left: 320px; + top: 90px; + width: 465px; } \ No newline at end of file -- cgit v1.3 From 2ad84e755aeafe10148df06e11a77470089c3cf7 Mon Sep 17 00:00:00 2001 From: hukl Date: Tue, 3 Apr 2012 21:17:43 +0200 Subject: make quote italic --- app/views/layouts/application.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 8965922..a7e831a 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -44,7 +44,7 @@ <%= link_to t(:sponsors), content_path("sponsors") %>

- »They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.« Benjamin Franklin + »They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.« Benjamin Franklin

-- cgit v1.3 From c6b51a960390737e8f9eaf942edabd25639ddf89 Mon Sep 17 00:00:00 2001 From: hukl Date: Tue, 3 Apr 2012 21:20:21 +0200 Subject: franklin on a sepatate line --- app/views/layouts/application.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index a7e831a..2b66dbb 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -44,7 +44,9 @@ <%= link_to t(:sponsors), content_path("sponsors") %>

- »They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.« Benjamin Franklin + »They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.« +
+ Benjamin Franklin

-- cgit v1.3 From 45a7fc4e531c5f42bcc6fd883d260242601b37fa Mon Sep 17 00:00:00 2001 From: hukl Date: Tue, 3 Apr 2012 21:21:12 +0200 Subject: forgot css --- public/stylesheets/ccc.css | 1 - 1 file changed, 1 deletion(-) diff --git a/public/stylesheets/ccc.css b/public/stylesheets/ccc.css index bd6001d..19cb662 100644 --- a/public/stylesheets/ccc.css +++ b/public/stylesheets/ccc.css @@ -269,5 +269,4 @@ p#quote { position: absolute; left: 320px; top: 90px; - width: 465px; } \ No newline at end of file -- cgit v1.3 From 31b7d2c7e4c44ce6dfea78288495c259241bb675 Mon Sep 17 00:00:00 2001 From: hukl Date: Tue, 3 Apr 2012 21:29:41 +0200 Subject: pull footer out of wrapper --- app/views/layouts/application.html.erb | 14 +++++++------- public/stylesheets/ccc.css | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2b66dbb..627aa14 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -36,8 +36,14 @@
<%= yield :layout %> +
+
+ <%= tags %> + <%= featured_articles %> +
+ - -
- <%= tags %> - <%= featured_articles %> -
- \ No newline at end of file diff --git a/public/stylesheets/ccc.css b/public/stylesheets/ccc.css index 19cb662..fcb45d6 100644 --- a/public/stylesheets/ccc.css +++ b/public/stylesheets/ccc.css @@ -23,6 +23,7 @@ div#wrapper { width: 909px; margin-left: 90px; text-align: left; + min-height: 600px; } pre { @@ -260,7 +261,6 @@ div#footer { position: relative; width: 1024px; height: 240px; - margin-left: -304px; background-image: url(/images/footer.png); background-repeat: no-repeat; } -- cgit v1.3 From d2e472283392f8d9325c3166505b31b4b3033aca Mon Sep 17 00:00:00 2001 From: hukl Date: Tue, 3 Apr 2012 21:31:45 +0200 Subject: increase min height --- public/stylesheets/ccc.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/ccc.css b/public/stylesheets/ccc.css index fcb45d6..8afc24c 100644 --- a/public/stylesheets/ccc.css +++ b/public/stylesheets/ccc.css @@ -23,7 +23,7 @@ div#wrapper { width: 909px; margin-left: 90px; text-align: left; - min-height: 600px; + min-height: 700px; } pre { -- cgit v1.3 From a4eb7aa1408b543e330b8f3a4b8f9058e76464aa Mon Sep 17 00:00:00 2001 From: hukl Date: Tue, 3 Apr 2012 21:32:55 +0200 Subject: even more min height --- public/stylesheets/ccc.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/ccc.css b/public/stylesheets/ccc.css index 8afc24c..290c40c 100644 --- a/public/stylesheets/ccc.css +++ b/public/stylesheets/ccc.css @@ -23,7 +23,7 @@ div#wrapper { width: 909px; margin-left: 90px; text-align: left; - min-height: 700px; + min-height: 800px; } pre { -- cgit v1.3 From db72fe84339c87a58910ee5f6903bbc95a14d279 Mon Sep 17 00:00:00 2001 From: hukl Date: Tue, 3 Apr 2012 21:34:44 +0200 Subject: a little less --- public/stylesheets/ccc.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/ccc.css b/public/stylesheets/ccc.css index 290c40c..9d9054f 100644 --- a/public/stylesheets/ccc.css +++ b/public/stylesheets/ccc.css @@ -23,7 +23,7 @@ div#wrapper { width: 909px; margin-left: 90px; text-align: left; - min-height: 800px; + min-height: 750px; } pre { -- cgit v1.3 From c4296b59a7f9d667d295f9c37b71f7849b818fb3 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Tue, 28 Jan 2025 22:47:15 +0100 Subject: Big overhaul patch and style changes --- app/controllers/admin_controller.rb | 11 +- app/controllers/application_controller.rb | 10 +- app/controllers/content_controller.rb | 26 +- app/controllers/tags_controller.rb | 47 ++-- app/helpers/admin_helper.rb | 6 +- app/helpers/content_helper.rb | 12 +- app/helpers/nodes_helper.rb | 4 + app/models/occurrence.rb | 3 +- app/models/page.rb | 12 +- app/views/content/_featured_articles.html.erb | 33 ++- app/views/content/_main_navigation.html.erb | 8 +- .../public/no_date_and_author.html.erb | 4 +- .../no_title_abstract_date_and_author.html.erb | 4 +- .../public/standard_template.html.erb | 4 +- .../page_templates/public/title_only.html.erb | 4 +- .../custom/page_templates/public/update.html.erb | 4 +- app/views/custom/partials/_article.html.erb | 4 +- .../custom/partials/_no_date_and_author.html.erb | 4 +- app/views/layouts/application.html.erb | 17 +- app/views/layouts/pages.html.erb | 2 + app/views/nodes/edit.html.erb | 2 +- app/views/rss/recent_changes.xml.builder | 8 +- app/views/rss/updates.rdf.builder | 18 +- app/views/rss/updates.xml.builder | 7 +- app/views/search/_search_result.html.erb | 6 +- config/boot.rb | 1 + config/environment.rb | 31 ++- config/environments/production.rb | 3 +- config/sphinx.yml | 3 +- public/stylesheets/ccc.css | 297 ++++++++++++++++----- .../routing-filter/lib/routing_filter/locale.rb | 6 +- 31 files changed, 430 insertions(+), 171 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 1d1a1ca..cdfe564 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -20,13 +20,17 @@ class AdminController < ApplicationController end def search - @results = Node.search params[:search_term] + @results = Node.search params[:search_term], :per_page => 1000 respond_to do |format| - format.html + format.html do + render :template => 'admin/search_results.html' + end format.js do render( :json => @results.map do |node| - {:id => node.id, :title => node.title, :edit_path => node_path(node)} + if node + {:id => node.id, :title => node.title, :edit_path => node_path(node)} + end end ) @@ -46,7 +50,6 @@ class AdminController < ApplicationController render :partial => 'admin/menu_search_results' end - format.js do render( :json => @results.map do |node| {:node_id => node.id, :title => node.title, :unique_name => node.unique_name} diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bce0c71..89cd330 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,20 +2,20 @@ # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base - + include ExceptionNotifiable include AuthenticatedSystem - + helper :all # include all helpers, all the time protect_from_forgery # See ActionController::RequestForgeryProtection for details # Scrub sensitive parameters from your log filter_parameter_logging :password, :password_confirmation - + before_filter :set_locale - + protected - + def set_locale if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym) I18n.locale = params[:locale].to_sym diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index 1b13456..c62b726 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb @@ -1,30 +1,30 @@ class ContentController < ApplicationController - + # Public - + before_filter :find_page - + # This is the method that renders most of the the public content. It recieves - # a :locale and a :page_path parameter through the params hash. It looks up + # a :locale and a :page_path parameter through the params hash. It looks up # the node with the corresponding unique_name attribute. The method doesn't - # return a node though, the node is really a proxy object for pages. It + # return a node though, the node is really a proxy object for pages. It # returns the most recent page associated to this node instead. def render_page - + expires_in 20.minutes, :public => true - + if @page and @page.public? render( :file => @page.valid_template, :layout => true ) else - render( + render( :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404 ) end - + end def render_gallery @@ -35,10 +35,14 @@ class ContentController < ApplicationController render :nothing => true, :status => 404 end end - + private def find_page path = params[:page_path].join('/') - @page = Node.find_page(path) + if path =~ /^[a-zA-Z\:\/\/\.\-\d_]+$/ + @page = Node.find_page(path) + else + @page = nil + end end end diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 565cdd4..bf64b73 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -1,33 +1,40 @@ class TagsController < ApplicationController - + # Public - + def index @page = Page.new :title => "Tags" - + @tags = Tag.all(:limit => 500) end def show - @tag = Tag.find_by_name(params[:id]) - - @tag = @tag ? @tag.name : params[:id] - - @page = Page.new - - params[:page] = ( params[:page].is_a?(Fixnum) ? params[:page] : 1 ) - - @pages = Page.heads.paginate( - Page.find_options_for_find_tagged_with(@tag).merge( - :order => 'published_at DESC', - :page=>params[:page], - :per_page => 23 + tag_name = params[:id] + + if tag_name.match(/^[a-zA-Z0-9_\w\s\-\.\']+$/) + @tag = Tag.find_by_name(tag_name) + @tag = @tag ? @tag.name : tag_name + @page = Page.new + + params[:page] = ( params[:page].is_a?(Fixnum) ? params[:page] : 1 ) + + @pages = Page.heads.paginate( + Page.find_options_for_find_tagged_with(@tag).merge( + :order => 'published_at DESC', + :page=>params[:page], + :per_page => 23 + ) ) - ) - - respond_to do |format| - format.html {} + + respond_to do |format| + format.html {} + end + else + respond_to do |format| + format.html { render :nothing => true, :status => 400 } + end end + end end diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index da8945e..232862b 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -3,9 +3,9 @@ module AdminHelper def language_selector case I18n.locale when :de - link_to 'English', url_for(:overwrite_params => {:locale => :en}) + link_to 'English (Aktiv: Deutsch)', url_for(:overwrite_params => {:locale => :en}) when :en - link_to 'Deutsch', url_for(:overwrite_params => {:locale => :de}) + link_to 'Deutsch (Active: English)', url_for(:overwrite_params => {:locale => :de}) end end -end \ No newline at end of file +end diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb index d6c96f1..7286976 100644 --- a/app/helpers/content_helper.rb +++ b/app/helpers/content_helper.rb @@ -9,13 +9,13 @@ module ContentHelper end def calendar - occurrences = Occurrence.find_in_range(Time.now, (Time.now+14.days)) + occurrences = Occurrence.find_in_range(Time.now, (Time.now+6.weeks)) if occurrences.empty? occurrences = Occurrence.find_next end - occurrences = occurrences.reject { |o| o.node.head.nil? } + occurrences = occurrences.reject { |o| o.node.nil? || o.node.head.nil? } render( :partial => 'content/front_page_calendar', @@ -75,6 +75,8 @@ module ContentHelper def aggregate? content options = {} + cccms_attributes = ActionView::Base.sanitized_allowed_attributes + [ 'lang' ] + begin if content =~ /]*)>/ tag = $~.to_s @@ -87,13 +89,13 @@ module ContentHelper options[:partial] = select_partial( options[:partial] ) - sanitize( content.sub(tag, render_collection(options)) ) + sanitize( content.sub(tag, render_collection(options)), :attributes => cccms_attributes ) else - sanitize( content ) + sanitize( content, :attributes => cccms_attributes ) end rescue - sanitize( content ) + sanitize( content, :atttributes => cccms_attributes ) end end diff --git a/app/helpers/nodes_helper.rb b/app/helpers/nodes_helper.rb index d889719..204ad8a 100644 --- a/app/helpers/nodes_helper.rb +++ b/app/helpers/nodes_helper.rb @@ -4,6 +4,10 @@ module NodesHelper if node.head node.head.title else + if not node.draft or not node.draft.title + logger.error "Missing title in node #{node.id}" + return "NO TITLE" + end node.draft.title end end diff --git a/app/models/occurrence.rb b/app/models/occurrence.rb index 591e1e0..62432d5 100644 --- a/app/models/occurrence.rb +++ b/app/models/occurrence.rb @@ -16,7 +16,8 @@ class Occurrence < ActiveRecord::Base :include => :node, :conditions => [ "start_time > ? AND end_time < ?", start_time, end_time - ] + ], + :order => "start_time" ) end diff --git a/app/models/page.rb b/app/models/page.rb index c5da386..0cfad53 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -149,6 +149,16 @@ class Page < ActiveRecord::Base published_at.nil? ? true : published_at < Time.now end + def effective_lang + if translated_locales.empty? + return 'de' + elsif translated_locales.include?(I18n.locale) + return I18n.locale + else + return translated_locales.first + end + end + # Returns true if a page has translations where one of them is significantly # older than the other. # Takes the I18n.default locale and a second :locale to test if the @@ -238,4 +248,4 @@ class Page < ActiveRecord::Base end end -end \ No newline at end of file +end diff --git a/app/views/content/_featured_articles.html.erb b/app/views/content/_featured_articles.html.erb index 75e2e1d..0220abb 100644 --- a/app/views/content/_featured_articles.html.erb +++ b/app/views/content/_featured_articles.html.erb @@ -1,5 +1,14 @@ diff --git a/app/views/content/_main_navigation.html.erb b/app/views/content/_main_navigation.html.erb index 67d4ecc..a984512 100644 --- a/app/views/content/_main_navigation.html.erb +++ b/app/views/content/_main_navigation.html.erb @@ -3,5 +3,11 @@ <% menu_items.each do |item| %>
  • <%= link_to_path item.title, item.path %>
  • <% end %> +
  • + <%= language_selector %> +
  • +
  • + +
  • - \ No newline at end of file + diff --git a/app/views/custom/page_templates/public/no_date_and_author.html.erb b/app/views/custom/page_templates/public/no_date_and_author.html.erb index b019805..fa39e54 100644 --- a/app/views/custom/page_templates/public/no_date_and_author.html.erb +++ b/app/views/custom/page_templates/public/no_date_and_author.html.erb @@ -1,8 +1,8 @@ -
    +

    <%= @page.title %>

    <%= sanitize( @page.abstract ) %>

    <%= headline_image %>
    <%= aggregate?(@page.body) %>
    -<%= will_paginate(@content_collection) if @content_collection %> \ No newline at end of file +<%= will_paginate(@content_collection) if @content_collection %> diff --git a/app/views/custom/page_templates/public/no_title_abstract_date_and_author.html.erb b/app/views/custom/page_templates/public/no_title_abstract_date_and_author.html.erb index 83cbff6..64e2a7c 100644 --- a/app/views/custom/page_templates/public/no_title_abstract_date_and_author.html.erb +++ b/app/views/custom/page_templates/public/no_title_abstract_date_and_author.html.erb @@ -1,6 +1,6 @@ -
    +
    <%= headline_image %>
    <%= aggregate?(@page.body) %>
    -<%= will_paginate(@content_collection) if @content_collection %> \ No newline at end of file +<%= will_paginate(@content_collection) if @content_collection %> diff --git a/app/views/custom/page_templates/public/standard_template.html.erb b/app/views/custom/page_templates/public/standard_template.html.erb index 8000af5..bbc8cd0 100644 --- a/app/views/custom/page_templates/public/standard_template.html.erb +++ b/app/views/custom/page_templates/public/standard_template.html.erb @@ -1,8 +1,8 @@ -
    +

    <%= @page.title %>

    <%= sanitize( @page.abstract )%>

    <%= headline_image %>
    <%= aggregate?(@page.body) %>
    -<%= will_paginate(@content_collection) if @content_collection %> \ No newline at end of file +<%= will_paginate(@content_collection) if @content_collection %> diff --git a/app/views/custom/page_templates/public/title_only.html.erb b/app/views/custom/page_templates/public/title_only.html.erb index 09c7455..42fe9a6 100644 --- a/app/views/custom/page_templates/public/title_only.html.erb +++ b/app/views/custom/page_templates/public/title_only.html.erb @@ -1,7 +1,7 @@ -
    +

    <%= @page.title %>

    <%= headline_image %>
    <%= aggregate?(@page.body) %>
    -<%= will_paginate(@content_collection) if @content_collection %> \ No newline at end of file +<%= will_paginate(@content_collection) if @content_collection %> diff --git a/app/views/custom/page_templates/public/update.html.erb b/app/views/custom/page_templates/public/update.html.erb index 5ea277a..d5995ac 100644 --- a/app/views/custom/page_templates/public/update.html.erb +++ b/app/views/custom/page_templates/public/update.html.erb @@ -1,4 +1,4 @@ -
    +

    <%= @page.title %>

    <%= date_for_page @page %>, <%= @page.user.try(:login) %>

    <%= sanitize( @page.abstract )%>

    @@ -6,4 +6,4 @@
    <%= aggregate?(@page.body) %>
    -<%= will_paginate(@content_collection) if @content_collection %> \ No newline at end of file +<%= will_paginate(@content_collection) if @content_collection %> diff --git a/app/views/custom/partials/_article.html.erb b/app/views/custom/partials/_article.html.erb index 433c31c..b738ac7 100644 --- a/app/views/custom/partials/_article.html.erb +++ b/app/views/custom/partials/_article.html.erb @@ -1,7 +1,7 @@ -
    +

    <%= link_to_path page.title, page.node.unique_name %>

    <%= date_for_page page %>, <%= author_for_page page %>

    <%= page.abstract %> <%= link_to_path t(:more), page.node.unique_name %>

    -
    \ No newline at end of file +
    diff --git a/app/views/custom/partials/_no_date_and_author.html.erb b/app/views/custom/partials/_no_date_and_author.html.erb index 61d6aac..fed02ac 100644 --- a/app/views/custom/partials/_no_date_and_author.html.erb +++ b/app/views/custom/partials/_no_date_and_author.html.erb @@ -1,4 +1,4 @@ -
    +

    <%= link_to page.title, content_path(page.node.unique_path) %>

    <%= page.abstract %>

    -
    \ No newline at end of file +
    diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 3c95d75..e6efccf 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -4,6 +4,11 @@ + + + + + <%= page_title %> <%= stylesheet_link_tag "ccc" %> @@ -16,7 +21,7 @@ <%= auto_discovery_link_tag(:rss, {:locale => :de, :controller => "rss", :action => "updates", :format => :rdf}) %> - +
    - \ No newline at end of file + diff --git a/app/views/layouts/pages.html.erb b/app/views/layouts/pages.html.erb index 327e0eb..70ceece 100644 --- a/app/views/layouts/pages.html.erb +++ b/app/views/layouts/pages.html.erb @@ -4,6 +4,8 @@ + + Pages: <%= controller.action_name %> <%= stylesheet_link_tag 'scaffold' %> diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index 8e27d0f..b9260d2 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb @@ -107,4 +107,4 @@ <% end %> <% end %> -
    \ No newline at end of file +
    diff --git a/app/views/rss/recent_changes.xml.builder b/app/views/rss/recent_changes.xml.builder index c3b3ec9..cce3b5d 100644 --- a/app/views/rss/recent_changes.xml.builder +++ b/app/views/rss/recent_changes.xml.builder @@ -2,19 +2,19 @@ xml.instruct! xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do xml.title("CCC.de Recent Change") - xml.link(:href => "http://www.ccc.de/") + xml.link(:href => "https://www.ccc.de/") xml.link(:rel => "self", :href => "/rss/updates.xml") xml.updated(@items.first.updated_at.xmlschema) xml.author do xml.name("Chaos Computer Club e.V.") end - xml.id("http://www.ccc.de/") + xml.id("https://www.ccc.de/") @items.each do |item| xml.entry do xml.title(item.title) xml.link( - :href => "http://www.ccc.de/#{item.node.unique_path}", + :href => "https://www.ccc.de/#{item.node.unique_path}", :rel => "alternate" ) xml.id(content_url_helper(item.node.unique_path)) @@ -26,4 +26,4 @@ xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do end -end \ No newline at end of file +end diff --git a/app/views/rss/updates.rdf.builder b/app/views/rss/updates.rdf.builder index 00b6242..cc63201 100644 --- a/app/views/rss/updates.rdf.builder +++ b/app/views/rss/updates.rdf.builder @@ -2,26 +2,26 @@ xml.instruct! xml.tag!("rdf:RDF", "xmlns:rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "xmlns:dc" => "http://purl.org/dc/elements/1.1/", "xmlns" => "http://purl.org/rss/1.0/") do xml.tag!( "rdf:Description", "rdf:about" => "http://www.w3.org/TR/rdf-syntax-grammar", "dc:title"=>"RDF/XML Syntax Specification (Revised)") - xml.channel do + xml.channel( "rdf:about" => "https://www.ccc.de/de/rss/updates.xml" ) do xml.title("Chaos Computer Club: Updates") - xml.link("http://www.ccc.de") + xml.link("https://www.ccc.de") xml.description("Kabelsalat ist gesund.") xml.tag!("dc:date", @items.first.published_at.xmlschema) end - - xml.image( "rdf:about" => "http://www.ccc.de/images/chaosknoten.gif") do + + xml.image( "rdf:about" => "https://www.ccc.de/images/chaosknoten.gif") do xml.title("Chaos Computer Club (Chaosknoten)") - xml.link("http://www.ccc.de") - xml.url("http://www.ccc.de/images/chaosknoten.gif") + xml.link("https://www.ccc.de") + xml.url("https://www.ccc.de/images/chaosknoten.gif") end - + @items.each do |item| xml.item("rdf:about" => content_url(:page_path => item.node.unique_path)) do xml.title(item.title) xml.link(content_url(:page_path => item.node.unique_path)) xml.description(item.abstract) - xml.tag!("dc:creator", item.user.login) + xml.tag!("dc:creator", (item.user ? item.user.login : "CCC")) xml.tag!("dc:date", item.published_at.xmlschema) end end -end \ No newline at end of file +end diff --git a/app/views/rss/updates.xml.builder b/app/views/rss/updates.xml.builder index c09c9c9..6afcd56 100644 --- a/app/views/rss/updates.xml.builder +++ b/app/views/rss/updates.xml.builder @@ -2,13 +2,13 @@ xml.instruct! xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do xml.title("Chaos Computer Club Updates") - xml.link(:href => "http://www.ccc.de/") + xml.link(:href => "https://www.ccc.de/") xml.link(:rel => "self", :href => "#{@host}/rss/updates") xml.updated(@items.first.published_at.xmlschema) xml.author do xml.name("Chaos Computer Club e.V.") end - xml.id("#{@host}/rss/updates") + xml.id("https://www.ccc.de/rss/updates") @items.each do |item| xml.entry do @@ -21,6 +21,7 @@ xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do xml.id(content_url(:page_path => item.node.feed_id)) xml.updated(item.updated_at.xmlschema) xml.published(item.published_at.xmlschema) + xml.summary(item.abstract) xml.content(:type => "xhtml") do xml.div(item.body, :xmlns => "http://www.w3.org/1999/xhtml") end @@ -28,4 +29,4 @@ xml.feed(:xmlns => "http://www.w3.org/2005/Atom", "xml:base" => @host) do end -end \ No newline at end of file +end diff --git a/app/views/search/_search_result.html.erb b/app/views/search/_search_result.html.erb index 14898a2..6cd01f8 100644 --- a/app/views/search/_search_result.html.erb +++ b/app/views/search/_search_result.html.erb @@ -1,6 +1,6 @@ -<% if node.head %> -
    +<% if node and node.head %> +

    <%= link_to node.head.title, content_path(node.unique_path) %>

    <%= node.head.abstract %>

    -<% end %> \ No newline at end of file +<% end %> diff --git a/config/boot.rb b/config/boot.rb index dd5e3b6..9834fc4 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -2,6 +2,7 @@ # Configure your app in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) +ENV['NLS_LANG'] = 'de_DE.UTF8' module Rails class << self diff --git a/config/environment.rb b/config/environment.rb index ec7ffa9..57b9ef2 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,11 +1,33 @@ # Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION +RAILS_GEM_VERSION = '2.3.15' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') +# monkey patch for 2.0. Will ignore vendor gems. +if RUBY_VERSION >= "2.0.0" + module Gem + def self.source_index + sources + end + + def self.cache + sources + end + + SourceIndex = Specification + + class SourceList + # If you want vendor gems, this is where to start writing code. + def search( *args ); []; end + def each( &block ); end + include Enumerable + end + end +end + Rails::Initializer.run do |config| # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers @@ -23,7 +45,7 @@ Rails::Initializer.run do |config| # config.gem "rake", :version => ">= 0.8.3" # config.gem "rack", :version => ">= 0.9.1" config.gem "pg" - config.gem "thinking-sphinx", :lib => 'thinking_sphinx', :version => '1.4.3' + config.gem "thinking-sphinx", :lib => 'thinking_sphinx', :version => '1.5.0' config.gem "libxml-ruby", :lib => 'xml' config.gem "erdgeist-chaos_calendar", :lib => "chaos_calendar", :source => "http://gems.github.com" @@ -55,9 +77,10 @@ Rails::Initializer.run do |config| # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] config.i18n.default_locale = :de + end require 'awesome_patch' -ExceptionNotifier.exception_recipients = %w(hukl@berlin.ccc.de) -ExceptionNotifier.sender_address = %("CCCMS Error" ) +ExceptionNotifier.exception_recipients = %w(erdgeist@ccc.de) +ExceptionNotifier.sender_address = %("CCCMS Error" ) diff --git a/config/environments/production.rb b/config/environments/production.rb index 68ceccd..3195745 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -32,4 +32,5 @@ ActionMailer::Base.sendmail_settings = { :arguments => '-i -t' } ActionMailer::Base.perform_deliveries = true -ActionMailer::Base.raise_delivery_errors = true \ No newline at end of file +ActionMailer::Base.raise_delivery_errors = true + diff --git a/config/sphinx.yml b/config/sphinx.yml index a01c216..3dc9195 100644 --- a/config/sphinx.yml +++ b/config/sphinx.yml @@ -8,4 +8,5 @@ production: config_file: "/usr/local/etc/sphinx.conf" searchd_log_file: "/var/log/searchd.log" query_log_file: "/var/log/searchd.query.log" - pid_file: "/var/run/sphinxsearch/searchd.pid" \ No newline at end of file + max_matches: 10000 + pid_file: "/var/run/sphinxsearch/searchd.pid" diff --git a/public/stylesheets/ccc.css b/public/stylesheets/ccc.css index c58e3ae..c782b1f 100644 --- a/public/stylesheets/ccc.css +++ b/public/stylesheets/ccc.css @@ -1,28 +1,51 @@ body { - background-color: #FFFFFF; margin: 0; padding: 0; text-align: center; font-family: Verdana, Helvetica, Arial, sans-serif; - font-size: 11px; - line-height: 16px; - background-color: #ffffff; - color: #535353; + background-color: Canvas; + hyphens: auto; + color: color-mix(in srgb, CanvasText, #808080 30%); + color-scheme: light dark; +} + +body:has(#light-mode:checked) { + color-scheme: light; +} + +@media (prefers-color-scheme: light) { +#light-mode-li, #light-mode, label[for=light-mode] { + display: none; +} +} + +@media (prefers-color-scheme: dark) { +body:not(:has(#light-mode:checked)) #header img, +body:not(:has(#light-mode:checked)) div#left_column::before +{ + filter: invert(50%); +} } -div#header { - height: 224px; +p { + line-height: 1.5em; +} + +img { + max-width: 100%; } div#header img { border: none; } -div#wrapper { - position: relative; - width: 909px; - margin-left: 90px; - text-align: left; +@media(min-width:1016px) { + div#wrapper { + position: relative; + width: 909px; + margin: 0 auto 0 auto; + text-align: left; + } } pre { @@ -51,18 +74,17 @@ a:hover { /*------------------headlines-------------------*/ h2 { - font-size: 15px; - line-height: 20px; - font-family: Helvetica; + font-size: 1.5rem; + font-family: Helvetica, Arial, sans-serif; } div#center_column h2 a { - color: #535353; + color: color-mix(in srgb, CanvasText, #808080 80%); text-decoration: none; } div#center_column h2 a:hover { - color: #8e8e8e; + color: color-mix(in srgb, CanvasText, #808080 10%); } div#center_column h2.headline { @@ -76,31 +98,65 @@ div.article_partial h2 a { } h3 { - font-size: 13px; + font-size: 1.3rem; text-decoration: none; } h4 { - font-size: 11px; + font-size: 1.0rem; text-decoration: bold; } +#left_column { + font-size: .8em; + line-height: 1.5em; +} + /*------------------main-navigation-------------------*/ div.main_navigation ul { margin-left: 0; padding-left: 0; - line-height: 18px; + padding-left: 15px; + padding-right: 15px; + text-align: left; } div.main_navigation li { list-style-type: none; + display: inline-block; + line-height: 1.75em; +} + +div.main_navigation li::after { + content: '-'; + color: #aeadad; + margin-left: .3em; +} + +div.main_navigation li:last-child::after { + content: none; +} + +@media(min-width:1016px) { + div.main_navigation ul { + padding: 0; + text-align: right; + } + + div.main_navigation li { + display: block; + line-height: 1.45em; + } + + div.main_navigation li::after { + content: none; + } } div.main_navigation a { text-decoration: none; - font-size: 14px; } div.main_navigation a.inactive:hover { @@ -108,34 +164,68 @@ div.main_navigation a.inactive:hover { } div.main_navigation a.active { - color: #000000; + color: CanvasText; text-decoration: none; - font-size: 13px; } div.main_navigation a.inactive { color: #aeadad; - font-size: 13px; } /*------------------calendar-featured-tags-------------------*/ div#frontpage_calendar { - margin-top: 30px; + display: none; + margin-top: 10px; +} + +@media(min-width:1016px) { + div#frontpage_calendar { + margin-top: 30px; + } } div#frontpage_calendar h2, div#tags h2, div#featured_articles h2 { color: #aeadad; border-top: 2px solid #aeadad; border-bottom: 2px solid #aeadad; - font-size: 16px; + font-size: 1.1em; padding-top: 2px; padding-bottom: 2px; } +div#frontpage_calendar h2 { + display: none; + border-top: none; + margin-left: auto; + margin-right: auto; + padding-left: 0.5em; + padding-right: 0.5em; + margin-top: 0; +} + +@media(min-width:1016px) { + div#frontpage_calendar h2, div#tags h2, div#featured_articles h2 { + font-size: 16px; + } + + div#frontpage_calendar h2 { + display: block; + border-top: 2px solid #aeadad; + padding: 2px 0; + } +} + div#frontpage_calendar ul, div#tags ul, div#featured_articles ul { padding: 0px; - font-size: 11px; + font-size: 0.8em; + line-height: 1.5em; +} + +@media(min-width:1016px) { + div#tags ul { + font-size: 0.8rem; + } } div#featured_articles #ds_icon img { @@ -170,40 +260,63 @@ div#featured_articles li a:hover { div.author_and_date { font-style: italic; - padding-left: 15px; + padding-left: 2em; font-family: Georgia; } -div#left_column { - position: absolute; - background-image: url(/images/left_column.png); - background-position: top right; - background-repeat: no-repeat; - left: 0px; - width: 115px; - min-height: 100px; - text-align: right; - padding-right: 70px; +@media(min-width:1016px) { + div#left_column::before { + content: " "; + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + box-sizing: border-box; + background-image: url(/images/left_column.png); + background-position: top right; + background-repeat: no-repeat; + z-index: -10; + } + div#left_column { + position: absolute; + left: 0px; + width: 115px; + min-height: 100px; + text-align: right; + padding-right: 70px; + } + + div#left_column > a { + font-size: 0.8rem; + } } div#center_column { - position: absolute; - background-color: #ffffff; - left: 200px; - width: 460px; padding-left: 15px; padding-right: 15px; padding-bottom: 40px; } -div#right_column { - position: absolute; - background-color: #ffffff; - padding-left: 70px; - left: 675px; - width: 155px; - height: 100px; +@media(min-width: 1016px) { + div#center_column { + position: absolute; + background-color: Canvas; + left: 200px; + width: 460px; + } +} + +@media(min-width:1016px) { + div#right_column { + position: absolute; + background-color: Canvas; + padding-left: 70px; + left: 675px; + width: 155px; + height: 100px; + } } div.teaser_ruler { @@ -219,21 +332,26 @@ div.article_partial { div.article_partial p.excerpt { - color: #404040; + color: color-mix(in srgb, CanvasText, #808080 50%); } -div#center_column div.body, -div#center_column div.abstract { - font-size: 11px; - line-height: 16px; +/* Search bar */ +#search form table { + display: inline-table; } -div#search { - position: absolute; - top: 145px; - left: 676px; - height: 20px; - vertical-align: top; +@media(min-width:1016px) { + #search form table { + display: table; + } + + div#search { + position: absolute; + top: 145px; + left: 676px; + height: 20px; + vertical-align: top; + } } div#search input[type=button] { @@ -248,10 +366,61 @@ div#search input[type=text] { height: 20px; width: 132px; line-height: 20px; - border: none; + border: solid Canvas 1px; + border-radius: 5px; background-image: url(/images/search_field.png); background-repeat:no-repeat; - padding-right: 5px; margin-right: 5px; - background-position: top top; -} \ No newline at end of file + text-indent: 0.5rem; + background-position: top; + color: #000; +} + +/* Header */ +#header > a { + display: block; + line-height: 0; +} + +/* Main section */ +.article, .article_partial { + font-size: .9rem; + text-align: left; +} + +/* +@media(min-width:1016px) { + .article, .article_partial { + font-size: 11px; + } +} +*/ + +h1, h2, h3 { + word-wrap: anywhere; + hyphens:auto; +} + +.pagination { + margin-bottom: .5em; +} + +li { + line-height: 1.5em; + margin-block-start: 1em; + margin-block-end: 1em; +} + +/* Footer */ +#footer { + border-bottom: 2px solid #aeadad; + border-top: 2px solid #aeadad; +} + +#footer > br { + display: none; +} + +#footer p { + margin: .5em auto; +} diff --git a/vendor/plugins/routing-filter/lib/routing_filter/locale.rb b/vendor/plugins/routing-filter/lib/routing_filter/locale.rb index 6fc3e11..7c86a40 100644 --- a/vendor/plugins/routing-filter/lib/routing_filter/locale.rb +++ b/vendor/plugins/routing-filter/lib/routing_filter/locale.rb @@ -17,14 +17,14 @@ module RoutingFilter def around_recognize(path, env, &block) locale = nil path.sub! %r(^/([a-zA-Z]{2})(?=/|$)) do locale = $1; '' end - returning yield do |params| + yield.tap do |params| params[:locale] = locale if locale end end def around_generate(*args, &block) locale = args.extract_options!.delete(:locale) || I18n.locale - returning yield do |result| + yield.tap do |result| if locale.to_sym != @@default_locale target = result.is_a?(Array) ? result.first : result target.sub!(%r(^(http.?://[^/]*)?(.*))){ "#{$1}/#{locale}#{$2}" } @@ -32,4 +32,4 @@ module RoutingFilter end end end -end \ No newline at end of file +end -- cgit v1.3 From 90d12694e5ec45b249e826abb8dbdaccd3ff5220 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Tue, 28 Jan 2025 22:52:26 +0100 Subject: Add some missing files --- app/views/admin/search_results.html.erb | 7 ++ public/images/Bluesky_Logo.svg | 4 + public/images/Fediverse.svg | 170 ++++++++++++++++++++++++++++++++ public/images/chaosknoten.svg | 57 +++++++++++ public/images/fairydust.jpg | Bin 0 -> 11205 bytes 5 files changed, 238 insertions(+) create mode 100644 app/views/admin/search_results.html.erb create mode 100644 public/images/Bluesky_Logo.svg create mode 100644 public/images/Fediverse.svg create mode 100644 public/images/chaosknoten.svg create mode 100644 public/images/fairydust.jpg diff --git a/app/views/admin/search_results.html.erb b/app/views/admin/search_results.html.erb new file mode 100644 index 0000000..671b665 --- /dev/null +++ b/app/views/admin/search_results.html.erb @@ -0,0 +1,7 @@ +

    Search Results

    + + diff --git a/public/images/Bluesky_Logo.svg b/public/images/Bluesky_Logo.svg new file mode 100644 index 0000000..c71e201 --- /dev/null +++ b/public/images/Bluesky_Logo.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/images/Fediverse.svg b/public/images/Fediverse.svg new file mode 100644 index 0000000..854e6f0 --- /dev/null +++ b/public/images/Fediverse.svg @@ -0,0 +1,170 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/images/chaosknoten.svg b/public/images/chaosknoten.svg new file mode 100644 index 0000000..36019f4 --- /dev/null +++ b/public/images/chaosknoten.svg @@ -0,0 +1,57 @@ + + + + + + + image/svg+xml + + + + + + + + diff --git a/public/images/fairydust.jpg b/public/images/fairydust.jpg new file mode 100644 index 0000000..997dbc2 Binary files /dev/null and b/public/images/fairydust.jpg differ -- cgit v1.3 From ff2e7fca6ab13e19ed1bd96b1e55540716e4bff9 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Wed, 29 Jan 2025 00:26:46 +0100 Subject: Some images changed --- public/images/chaosradio.png | Bin 9187 -> 13114 bytes public/images/ds.png | Bin 1209 -> 2368 bytes public/images/events.png | Bin 5290 -> 7328 bytes public/images/header.png | Bin 14716 -> 14296 bytes public/images/left_column.png | Bin 533 -> 2218 bytes public/images/media-ccc-de-banner.svg | 1 + public/images/search_button.png | Bin 4272 -> 3548 bytes 7 files changed, 1 insertion(+) create mode 100644 public/images/media-ccc-de-banner.svg diff --git a/public/images/chaosradio.png b/public/images/chaosradio.png index 9c4c10b..60aace1 100644 Binary files a/public/images/chaosradio.png and b/public/images/chaosradio.png differ diff --git a/public/images/ds.png b/public/images/ds.png index b6ef256..231ba90 100644 Binary files a/public/images/ds.png and b/public/images/ds.png differ diff --git a/public/images/events.png b/public/images/events.png index 31b8dee..257008d 100644 Binary files a/public/images/events.png and b/public/images/events.png differ diff --git a/public/images/header.png b/public/images/header.png index 47cf2ac..114c2e9 100644 Binary files a/public/images/header.png and b/public/images/header.png differ diff --git a/public/images/left_column.png b/public/images/left_column.png index 7505815..9ac1a49 100644 Binary files a/public/images/left_column.png and b/public/images/left_column.png differ diff --git a/public/images/media-ccc-de-banner.svg b/public/images/media-ccc-de-banner.svg new file mode 100644 index 0000000..5c95003 --- /dev/null +++ b/public/images/media-ccc-de-banner.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/search_button.png b/public/images/search_button.png index 9a59f04..177a740 100644 Binary files a/public/images/search_button.png and b/public/images/search_button.png differ -- cgit v1.3 From ce233e14800f91b5263cf66a9272004b80884d86 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Wed, 29 Jan 2025 03:20:57 +0100 Subject: Move footer back at its position --- app/views/layouts/application.html.erb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f0017ee..915091d 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -40,6 +40,13 @@
    <%= yield :layout %> +
    <%= tags %> @@ -47,6 +54,5 @@
    - -- cgit v1.3 From d72edba966ba2b55697685f3711dbfcb38d9fbc8 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Wed, 5 Feb 2025 22:48:19 +0100 Subject: fix edit node behaviour --- public/javascripts/admin_search.js | 123 +++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 54 deletions(-) diff --git a/public/javascripts/admin_search.js b/public/javascripts/admin_search.js index 6d3ca93..98571de 100644 --- a/public/javascripts/admin_search.js +++ b/public/javascripts/admin_search.js @@ -1,12 +1,12 @@ admin_search = { - + initialize : function() { $(document).bind("keydown", 'Alt+f', function(){ admin_search.display_toggle(); return false; }); }, - + display_toggle : function() { if ($('#search_widget').css("display") != "none") { $('#search_widget').fadeOut(); @@ -16,7 +16,7 @@ admin_search = { $('#search_term').attr("value", ""); $('#search_term').focus(); } - + $("#search_term").bind("keyup", function() { if ($(this).attr("value")) { $.ajax({ @@ -31,11 +31,11 @@ admin_search = { } else { $('#search_results').slideUp(); - $('#search_results').empty(); + $('#search_results').empty(); } }); }, - + show_results : function(results) { $('#search_results').empty(); for (result in results) { @@ -46,7 +46,7 @@ admin_search = { }; menu_items = { - + initialize_search : function() { $("#menu_search_term").bind("keyup", function() { if ($(this).attr("value")) { @@ -62,28 +62,28 @@ menu_items = { } else { $('#search_results').slideUp(); - $('#search_results').empty(); + $('#search_results').empty(); } }); }, - + show_results : function(results) { $("#search_results").empty(); for (result in results) { var link = $((""+ results[result].title + "")); $(link).bind("click", menu_items.link_closure(results[result])); - - + + // Sometimes I don't get jquery; wrap() didn't work *sigh* // Guess I'll need a book someday or another framework var wrapper = $("
    "); $(wrapper).append(link) - + $("#search_results").append(wrapper); - + } }, - + link_closure : function(node) { var barf = function(){ $("#menu_item_node_id").val(node.node_id); @@ -91,7 +91,7 @@ menu_items = { $("#menu_item_title").val(node.title); return false; } - + return barf; } }; @@ -99,7 +99,7 @@ menu_items = { parent_search = { initialize_search : function() { parent_search.initialize_radio_buttons(); - + $("#parent_search_term").bind("keyup", function() { if ($(this).attr("value")) { $.ajax({ @@ -114,28 +114,31 @@ parent_search = { } else { $('#search_results').slideUp(); - $('#search_results').empty(); + $('#search_results').empty(); } }); }, - + show_results : function(results) { $("#search_results").empty(); + var found = false; for (result in results) { var link = $((""+ results[result].title + "")); $(link).bind("click", parent_search.link_closure(results[result])); - - + + // Sometimes I don't get jquery; wrap() didn't work *sigh* // Guess I'll need a book someday or another framework var wrapper = $("
    "); - $(wrapper).append(link) - + $(wrapper).append(link); + $("#search_results").append(wrapper); - + found = true; } + if (found) + $('#search_results').slideDown(); }, - + link_closure : function(node) { var barf = function(){ $("#parent_search_term").attr("value", node.title); @@ -144,64 +147,76 @@ parent_search = { $('#search_results').empty(); return false; } - + return barf; }, - + initialize_radio_buttons : function() { $("#kind_top_level").bind("change", function(){ $("#parent_search_field").hide(); }); - + $("#kind_update").bind("change", function(){ $("#parent_search_field").hide(); }); - + $("#kind_generic").bind("change", function(){ $("#parent_search_field").show(); }); - + } } move_to_search = { - initialize_search : function() { - $("#move_to_search_term").bind("keyup", function() { - if ($(this).attr("value")) { - $.ajax({ - type: "GET", - url: "/admin/menu_search", - data: "search_term=" + $(this).attr("value"), - dataType: "json", - success : function(results) { - move_to_search.show_results(results); - } - }); - } - else { - $('#search_results').slideUp(); - $('#search_results').empty(); - } - }); + initialize_search : function() { + $("#move_to_search_term").bind("keyup", function() { move_to_search.do_search($(this))}); + $("#move_to_search_term").bind("keydown", function() { move_to_search.do_search($(this))}); + $("#move_to_search_term").bind("keypress", function() { move_to_search.do_search($(this))}); + $("#move_to_search_term").bind("paste", function() { move_to_search.do_search($(this))}); + $("#move_to_search_term").bind("cut", function() { move_to_search.do_search($(this))}); }, - + + do_search : function(_this) { + if (_this.attr("value")) { + $.ajax({ + type: "GET", + url: "/admin/menu_search", + data: "search_term=" + _this.attr("value"), + dataType: "json", + success : function(results) { + move_to_search.show_results(results); + } + }); + } + else { + $('#search_results').slideUp(); + $('#search_results').empty(); + } + }, + show_results : function(results) { $("#search_results").empty(); + var found = false; for (result in results) { var link = $((""+ results[result].title + "")); $(link).bind("click", move_to_search.link_closure(results[result])); - - + + // Sometimes I don't get jquery; wrap() didn't work *sigh* // Guess I'll need a book someday or another framework var wrapper = $("
    "); $(wrapper).append(link) - + $("#search_results").append(wrapper); - + found = true; } + if (found) + $('#search_results').slideDown(); + else + $('#search_results').slideUp(); + }, - + link_closure : function(node) { var barf = function(){ $("#move_to_search_term").attr("value", node.title); @@ -210,7 +225,7 @@ move_to_search = { $('#search_results').empty(); return false; } - + return barf; } -} \ No newline at end of file +} -- cgit v1.3 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 --- app/controllers/admin_controller.rb | 7 +++++++ app/views/admin/index.html.erb | 37 +++++++++++++++++++++++++++++++++-- public/javascripts/admin_interface.js | 17 +++++++++++++++- public/stylesheets/admin.css | 4 ++++ 4 files changed, 62 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index cdfe564..7c1375a 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -17,6 +17,13 @@ class AdminController < ApplicationController "updated_at < ? AND updated_at > ? AND parent_id IS NOT NULL", Time.now, Time.now-14.days ] ) + + all_nodes = Node.root.self_and_descendants + @sitemap_depth = {} + Node.each_with_level(all_nodes) do |node, level| + @sitemap_depth[node.id] = level + end + @sitemap = all_nodes.to_a.sort! { |node1,node2| node1.lft <=> node2.lft }.delete_if { |node| node.update? } end def search diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb index 526aa88..8c8271f 100644 --- a/app/views/admin/index.html.erb +++ b/app/views/admin/index.html.erb @@ -1,6 +1,7 @@

    recent changes current drafts + site map

    @@ -64,9 +65,41 @@ <%= node.lock_owner.login if node.lock_owner %> - <%= node.draft ? node.draft.revision : node.head.revision %> + <%= node.draft ? node.draft.revision : ( node.head ? node.head.revision : "EMPTY" ) %> <% end %> -
    \ No newline at end of file +
    + +
    + +

    Sitemap

    + + + + + + + + + <% @sitemap.each do |node| %> + <% if !node.nil? %> + "> + + + + + + <% end %> + <% end %> +
    IDTitleActionsLocked by
    <%= 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 %> +
    +
    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; }); } diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index f95fa18..fbb8a3f 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css @@ -170,6 +170,10 @@ table.node_table .actions { text-transform: lowercase; } +#admin_sitemap_table .node_id:before { + content: "• "; +} + /* Revisions */ table#revisions { -- cgit v1.3 From 38d80f0af731326fcd5ae16c0129a056eff2fe32 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Wed, 5 Feb 2025 23:05:01 +0100 Subject: Add warner if theres unescaped entities inside the Title fields --- app/views/nodes/edit.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index b9260d2..ee11047 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb @@ -90,7 +90,7 @@ Title - <%= d.text_field :title %> + <%= d.text_field :title, :pattern => "(?:[^<>&]|&amp;|&lt;|&gt;)*", :title => "Warning: Unescaped HTML entities detected! Use &lt;, &gt;, &amp; instead of <, >, &." %> Abstract -- 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(-) 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 6424e10be5a89f175a74c71c55660412a169b8b8 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Tue, 23 Jun 2026 18:04:37 +0200 Subject: Update deployed state to what's currently running --- Rakefile | 4 +- app/controllers/nodes_controller.rb | 1 + app/helpers/admin_helper.rb | 4 +- app/helpers/content_helper.rb | 6 +- app/models/node.rb | 29 +- app/models/page.rb | 15 +- app/views/admin/index.html.erb | 18 +- app/views/content/_featured_articles.html.erb | 6 +- app/views/content/_main_navigation.html.erb | 6 - app/views/content/_search.html.erb | 9 +- app/views/content/_tags.html.erb | 4 +- app/views/layouts/application.html.erb | 43 ++- app/views/nodes/edit.html.erb | 156 ++++----- config/database.mysql-sample.yml | 45 --- config/database.psql-sample.yml | 51 --- config/environments/production.rb | 2 +- config/locales/de.yml | 1 + config/locales/en.yml | 6 +- public/javascripts/public.js | 9 +- public/stylesheets/admin.css | 202 +++++++++--- public/stylesheets/ccc.css | 363 +++++++++++++++------ test/functional/nodes_controller_test.rb | 36 ++ vendor/plugins/paperclip/lib/paperclip/geometry.rb | 1 + 23 files changed, 637 insertions(+), 380 deletions(-) delete mode 100644 config/database.mysql-sample.yml delete mode 100644 config/database.psql-sample.yml diff --git a/Rakefile b/Rakefile index 3af2c3a..b8e1d62 100644 --- a/Rakefile +++ b/Rakefile @@ -5,7 +5,9 @@ require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' -require 'rake/rdoctask' + +#require 'rake/rdoctask' +#require 'rdoc/task' require 'tasks/rails' require 'thinking_sphinx/tasks' diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index b8cd644..95aed48 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb @@ -55,6 +55,7 @@ class NodesController < ApplicationController def show node = Node.find(params[:id]) + node.wipe_draft! @page = node.draft || node.head end diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 232862b..389f6dc 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -3,9 +3,9 @@ module AdminHelper def language_selector case I18n.locale when :de - link_to 'English (Aktiv: Deutsch)', url_for(:overwrite_params => {:locale => :en}) + link_to raw('English'), url_for(:overwrite_params => {:locale => :en}) when :en - link_to 'Deutsch (Active: English)', url_for(:overwrite_params => {:locale => :de}) + link_to raw('Deutsch'), url_for(:overwrite_params => {:locale => :de}) end end end diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb index 7286976..17364f8 100644 --- a/app/helpers/content_helper.rb +++ b/app/helpers/content_helper.rb @@ -43,7 +43,7 @@ module ContentHelper # Returns the published_at attribute of a page if it is not nil, otherwise # it returns the auto-filled value of the created_at attribute def date_for_page page - page.published_at.to_s(:db) rescue page.created_at.to_s(:db) + I18n.l(page.published_at, :format => :ccc) rescue I18n.l(page.created_at, :format => :ccc) end def author_for_page page @@ -80,10 +80,10 @@ module ContentHelper begin if content =~ /]*)>/ tag = $~.to_s - matched_data = $1.scan(/\w+\=\"[a-zA-Z\s\/_\d,]*\"/) + matched_data = $1.scan(/\w+\=\"[a-zA-Z\s\/_\d,.=]*\"/) matched_data.each do |data| - splitted_data = data.split("=") + splitted_data = data.split("=", 2) options[splitted_data[0].to_sym] = splitted_data[1].gsub(/\"/, "") end diff --git a/app/models/node.rb b/app/models/node.rb index 6c11fed..75122d1 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -3,11 +3,11 @@ class Node < ActiveRecord::Base acts_as_nested_set # Associations - has_many :pages, :order => "revision ASC" - belongs_to :head, :class_name => "Page", :foreign_key => :head_id - belongs_to :draft, :class_name => "Page", :foreign_key => :draft_id - has_many :permissions - has_one :event + has_many :pages, :order => "revision ASC", :dependent => :destroy + belongs_to :head, :class_name => "Page", :foreign_key => :head_id, :dependent => :destroy + belongs_to :draft, :class_name => "Page", :foreign_key => :draft_id, :dependent => :destroy + has_many :permissions, :dependent => :destroy + has_one :event, :dependent => :destroy belongs_to :lock_owner, :class_name => "User", :foreign_key => :locking_user_id # Callbacks @@ -60,6 +60,7 @@ class Node < ActiveRecord::Base # Instance Methods def find_or_create_draft current_user + self.wipe_draft! if draft && self.lock_owner == current_user draft elsif draft && self.lock_owner.nil? @@ -115,6 +116,24 @@ class Node < ActiveRecord::Base end end + # removes a draft and the lock if it is older than a day and still + # identical to head + def wipe_draft! + unless self.draft + self.unlock! + return + end + return unless self.head + return unless self.draft.updated_at < 1.day.ago + return if Page.find(self.head).has_changes_to? self.draft + + self.draft.destroy + self.draft_id = nil + self.unlock! + self.save! + self.reload + end + def restore_revision! revision if page = self.pages.find_by_revision(revision) self.head = page diff --git a/app/models/page.rb b/app/models/page.rb index 0cfad53..f804353 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -64,7 +64,7 @@ class Page < ActiveRecord::Base Page.heads.paginate( find_options_for_find_tagged_with( - options[:tags].gsub(/\s/, ","), :match_all => true + options[:tags].gsub(/\s/, ","), :match_all => true, :conditions => options[:conditions] ).merge( :page => page, :per_page => options[:limit], @@ -94,6 +94,19 @@ class Page < ActiveRecord::Base end end + # Is used to compare a node's head with the node's draft + + def has_changes_to? draft + return true unless node == draft.node + return true unless assets == draft.assets + return true unless tag_list == draft.tag_list + return true unless template_name == draft.template_name + return true unless translated_locales.sort_by(&:to_s) == draft.translated_locales.sort_by(&:to_s) + changed = false + translated_locales.each { |locale| I18n.with_locale(locale) { changed = true unless title == draft.title && abstract == draft.abstract && body == draft.body } } + return changed + end + # Instance Methods def public_template_path diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb index edad1d6..2741db3 100644 --- a/app/views/admin/index.html.erb +++ b/app/views/admin/index.html.erb @@ -1,14 +1,14 @@
    - <%= 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) %> +
    <%= link_to 'Create Update or Pressemitteilung', new_node_path, :only_path => false %>
    + + +
    <%= link_to("Upload a new asset", new_asset_path, :only_path => false) %>

    recent changes my work - current drafts + current drafts (<%= @drafts_count %>) site map

    @@ -39,7 +39,7 @@ <%= node.lock_owner.login if node.lock_owner %> - <%= node.draft ? node.draft.revision : node.head.revision %> + <%= link_to ( node.draft ? node.draft.revision : (node.head ? node.head.revision : "EMPTY" ) ), node_revisions_path(node) %> <% end %> @@ -73,7 +73,7 @@ <%= node.lock_owner.login if node.lock_owner %> - <%= node.draft ? node.draft.revision : node.head.revision %> + <%= link_to ( node.draft ? node.draft.revision : (node.head ? node.head.revision : "EMPTY" ) ), node_revisions_path(node) %> <% end %> @@ -107,7 +107,7 @@ <%= node.lock_owner.login if node.lock_owner %> - <%= node.draft ? node.draft.revision : ( node.head ? node.head.revision : "EMPTY" ) %> + <%= link_to ( node.draft ? node.draft.revision : (node.head ? node.head.revision : "EMPTY" ) ), node_revisions_path(node) %> <% end %> @@ -135,7 +135,7 @@ <%= link_to 'create subpage', new_node_path(:parent_id => node.id) %> - <%= link_to ':: Revisions', node_revisions_path(node) %> + <%= link_to 'Revisions', node_revisions_path(node) %> <%= node.lock_owner.login if node.lock_owner %> diff --git a/app/views/content/_featured_articles.html.erb b/app/views/content/_featured_articles.html.erb index 0220abb..c69911f 100644 --- a/app/views/content/_featured_articles.html.erb +++ b/app/views/content/_featured_articles.html.erb @@ -11,7 +11,7 @@ <%= link_to( image_tag( 'chaosradio.png' ), - "http://chaosradio.ccc.de/", + "https://chaosradio.ccc.de/", :id => "chaosradio_icon", :title => "Chaosradio" )%> @@ -25,14 +25,14 @@ <%= link_to( image_tag( 'ds.png' ), - "http://ds.ccc.de/", + "https://ds.ccc.de/", :id => "ds_icon", :title => "Datenschleuder" )%> <%= link_to( image_tag( 'events.png' ), - "http://events.ccc.de/", + "https://events.ccc.de/", :id => "events_icon", :title => "Events Blog" )%> diff --git a/app/views/content/_main_navigation.html.erb b/app/views/content/_main_navigation.html.erb index a984512..2fe8b77 100644 --- a/app/views/content/_main_navigation.html.erb +++ b/app/views/content/_main_navigation.html.erb @@ -3,11 +3,5 @@ <% menu_items.each do |item| %>
  • <%= link_to_path item.title, item.path %>
  • <% end %> -
  • - <%= language_selector %> -
  • -
  • - -
  • diff --git a/app/views/content/_search.html.erb b/app/views/content/_search.html.erb index 9f61042..e654462 100644 --- a/app/views/content/_search.html.erb +++ b/app/views/content/_search.html.erb @@ -1,8 +1,3 @@ <% form_tag search_path, :method => 'get' do %> - - - - - -
    <%= text_field_tag :search_term, params[:search_term] %><%= image_submit_tag("search_button.png") %>
    -<% end %> \ No newline at end of file +
    <%= text_field_tag :search_term, params[:search_term], :placeholder => 'suchen', :type => 'search' %>
    +<% end %> diff --git a/app/views/content/_tags.html.erb b/app/views/content/_tags.html.erb index d33bc10..fd808b6 100644 --- a/app/views/content/_tags.html.erb +++ b/app/views/content/_tags.html.erb @@ -1,3 +1,4 @@ +<% unless @page.tags.empty? %>

    Tags

      @@ -5,4 +6,5 @@
    • <%= link_to tag.name, tag_path(:id => tag.name) %>
    • <% end %>
    -
    \ No newline at end of file +
    +<% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 915091d..d2a624f 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,11 +1,10 @@ - + - + @@ -19,21 +18,45 @@ <%= auto_discovery_link_tag(:atom, {:locale => :de, :controller => "rss", :action => "updates", :format => :xml}) %> <%= auto_discovery_link_tag(:rss, {:locale => :de, :controller => "rss", :action => "updates", :format => :rdf}) %> + + +
    -