refinerycms-dashboard 1.0.11 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. data/app/controllers/refinery/admin/dashboard_controller.rb +40 -0
  2. data/app/helpers/refinery/admin/dashboard_helper.rb +25 -0
  3. data/app/views/{admin → refinery/admin}/dashboard/_actions.html.erb +13 -13
  4. data/app/views/{admin → refinery/admin}/dashboard/_additional_dashboard_menu_items.html.erb +0 -0
  5. data/app/views/{admin → refinery/admin}/dashboard/_recent_activity.html.erb +3 -1
  6. data/app/views/{admin → refinery/admin}/dashboard/_recent_inquiries.html.erb +1 -1
  7. data/app/views/refinery/admin/dashboard/_records.html.erb +2 -0
  8. data/app/views/{admin → refinery/admin}/dashboard/index.html.erb +4 -4
  9. data/app/views/{admin → refinery/admin}/dashboard/index.rss.builder +2 -2
  10. data/config/locales/bg.yml +26 -25
  11. data/config/locales/cs.yml +26 -25
  12. data/config/locales/da.yml +26 -25
  13. data/config/locales/de.yml +26 -25
  14. data/config/locales/el.yml +26 -25
  15. data/config/locales/en.yml +26 -25
  16. data/config/locales/es.yml +30 -29
  17. data/config/locales/fi.yml +26 -25
  18. data/config/locales/fr.yml +26 -25
  19. data/config/locales/it.yml +25 -27
  20. data/config/locales/ja.yml +27 -0
  21. data/config/locales/ko.yml +27 -0
  22. data/config/locales/lt.yml +26 -25
  23. data/config/locales/lv.yml +28 -27
  24. data/config/locales/nb.yml +26 -25
  25. data/config/locales/nl.yml +26 -25
  26. data/config/locales/pl.yml +30 -29
  27. data/config/locales/pt-BR.yml +30 -29
  28. data/config/locales/rs.yml +26 -25
  29. data/config/locales/ru.yml +30 -28
  30. data/config/locales/sk.yml +26 -25
  31. data/config/locales/sl.yml +26 -25
  32. data/config/locales/sv.yml +26 -25
  33. data/config/locales/vi.yml +26 -25
  34. data/config/locales/zh-CN.yml +26 -25
  35. data/config/locales/zh-TW.yml +26 -25
  36. data/config/routes.rb +5 -5
  37. data/lib/refinery/dashboard.rb +14 -0
  38. data/lib/refinery/dashboard/configuration.rb +9 -0
  39. data/lib/refinery/dashboard/engine.rb +28 -0
  40. data/lib/refinerycms-dashboard.rb +1 -33
  41. data/refinerycms-dashboard.gemspec +14 -67
  42. data/spec/requests/refinery/admin/dashboard_spec.rb +50 -0
  43. metadata +71 -55
  44. data/app/controllers/admin/dashboard_controller.rb +0 -38
  45. data/app/helpers/admin/dashboard_helper.rb +0 -24
  46. data/app/views/admin/dashboard/_records.html.erb +0 -2
  47. data/config/locales/jp.yml +0 -26
  48. data/config/locales/lolcat.yml +0 -25
  49. data/features/dashboard.feature +0 -35
  50. data/features/support/paths.rb +0 -14
  51. data/lib/gemspec.rb +0 -35
@@ -0,0 +1,40 @@
1
+ module Refinery
2
+ module Admin
3
+ class DashboardController < Refinery::AdminController
4
+
5
+ def index
6
+ @recent_activity = []
7
+
8
+ ::Refinery::Plugins.active.each do |plugin|
9
+ begin
10
+ plugin.activity.each do |activity|
11
+ @recent_activity << activity.klass.where(activity.conditions).
12
+ order(activity.order).
13
+ limit(activity.limit)
14
+ end
15
+ rescue
16
+ logger.warn "#{$!.class.name} raised while getting recent activity for dashboard."
17
+ logger.warn $!.message
18
+ logger.warn $!.backtrace.collect { |b| " > #{b}" }.join("\n")
19
+ end
20
+ end
21
+
22
+ @recent_activity = @recent_activity.flatten.compact.sort { |x,y|
23
+ y.updated_at <=> x.updated_at
24
+ }.first(Refinery::Dashboard.activity_show_limit)
25
+
26
+ @recent_inquiries = if Refinery::Plugins.active.find_by_name("refinery_inquiries")
27
+ Inquiry.latest(Refinery::Dashboard.activity_show_limit)
28
+ else
29
+ []
30
+ end
31
+ end
32
+
33
+ def disable_upgrade_message
34
+ Refinery::Core.show_internet_explorer_upgrade_message = false
35
+ render :nothing => true
36
+ end
37
+
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,25 @@
1
+ module Refinery
2
+ module Admin
3
+ module DashboardHelper
4
+
5
+ def activity_message_for(record)
6
+ if (plugin = Refinery::Plugins.active.find_by_model(record.class)) &&
7
+ (activity = plugin.activity_by_class_name(record.class.name).first)
8
+ # work out which action occured
9
+ action = record.updated_at.eql?(record.created_at) ? 'created' : 'updated'
10
+
11
+ # get article to define gender of model name, some languages require this for proper grammar
12
+ article = t('article', :scope => "refinery.plugins.#{plugin.name}.", :default => 'the')
13
+
14
+ # now create a link to the notification's corresponding record.
15
+ link_to t('.latest_activity_message',
16
+ :what => record.send(activity.title),
17
+ :kind => record.class.model_name.human,
18
+ :action => t("with_article \"#{article}\"", :scope => "refinery.#{action}")
19
+ ).downcase.capitalize, eval("#{activity.url}(#{activity.nesting("record")}record)")
20
+ end
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -1,47 +1,47 @@
1
1
  <ul>
2
- <% if Refinery::Plugins.active.names.include?("refinery_pages") %>
2
+ <% if ::Refinery::Plugins.active.names.include?("refinery_pages") %>
3
3
  <li>
4
4
  <%= link_to t('.add_a_new_page'),
5
- new_admin_page_path,
5
+ refinery.new_admin_page_path,
6
6
  :class => "add_icon" %>
7
7
  </li>
8
8
  <li>
9
9
  <%= link_to t('.update_a_page'),
10
- admin_pages_path,
10
+ refinery.admin_pages_path,
11
11
  :class => "edit_icon" %>
12
12
  </li>
13
13
  <% end %>
14
- <% if Refinery::Plugins.active.names.include?("refinery_files") %>
14
+ <% if ::Refinery::Plugins.active.names.include?("refinery_files") %>
15
15
  <li>
16
16
  <%= link_to t('.upload_a_file'),
17
- new_admin_resource_path(:dialog => true,
17
+ refinery.new_admin_resource_path(:dialog => true,
18
18
  :width => 600,
19
19
  :height => 300),
20
20
  :class => "add_icon" %>
21
21
  </li>
22
22
  <% end %>
23
- <% if Refinery::Plugins.active.names.include?("refinery_images") %>
23
+ <% if ::Refinery::Plugins.active.names.include?("refinery_images") %>
24
24
  <li>
25
25
  <%= link_to t('.upload_a_image'),
26
- new_admin_image_path(:dialog => true,
26
+ refinery.new_admin_image_path(:dialog => true,
27
27
  :width => 600,
28
28
  :height => 300),
29
29
  :class => "add_icon" %>
30
30
  </li>
31
31
  <% end %>
32
- <%= render :partial => 'additional_dashboard_menu_items' %>
32
+ <%= render 'additional_dashboard_menu_items' %>
33
33
  </ul>
34
34
 
35
35
  <% if ::Refinery.i18n_enabled? %>
36
- <% locales = ::Refinery::I18n.locales.clone %>
36
+ <% locales = Refinery::I18n.locales.clone %>
37
37
  <% current_locale = ::I18n.locale %>
38
38
  <% current_locale_title = locales.delete(current_locale) %>
39
39
  <ul id='current_locale'>
40
40
  <li>
41
- <%= link_to "#", :style => "background-image: url('/images/refinery/icons/flags/#{current_locale}.png');" do %>
41
+ <%= link_to "#", :style => "background-image: url('#{asset_path "refinery/icons/flags/#{current_locale}.png"}');" do %>
42
42
  <%= current_locale_title.respond_to?(:force_encoding) ? current_locale_title.force_encoding('utf-8') : current_locale_title %>
43
43
  <span><%= t('.change_language') %></span>
44
- <span style='display:none;'><%= t('cancel', :scope => 'shared.admin.form_actions') %></span>
44
+ <span style='display:none;'><%= t('cancel', :scope => 'refinery.admin.form_actions') %></span>
45
45
  <% end %>
46
46
  </li>
47
47
  </ul>
@@ -49,8 +49,8 @@
49
49
  <% locales.sort_by{|key, value| value}.each do |locale, locale_title| %>
50
50
  <li>
51
51
  <%= link_to locale_title.respond_to?(:force_encoding) ? locale_title.force_encoding('utf-8') : locale_title,
52
- params.dup.tap { |p| p[:set_locale] = locale },
53
- :style => "background-image: url('/images/refinery/icons/flags/#{locale}.png');" %>
52
+ refinery.admin_dashboard_path(:set_locale => locale),
53
+ :style => "background-image: url('#{asset_path "refinery/icons/flags/#{locale}.png"}');" %>
54
54
  </li>
55
55
  <% end %>
56
56
  </ul>
@@ -1,6 +1,8 @@
1
1
  <div id='recent_activity'>
2
2
  <h2><%= t('.latest_activity') %></h2>
3
- <% if (activity = @recent_activity.collect{|a| activity_message_for(a) rescue ''}.reject(&:blank?)).present? %>
3
+ <% if (activity = @recent_activity.collect { |a|
4
+ activity_message_for(a)
5
+ }.reject(&:blank?)).present? %>
4
6
  <ul class='clickable'>
5
7
  <% activity.each do |message| %>
6
8
  <li class='<%= cycle("on", "on-hover", :name => 'recent_activity_cycle') %>'>
@@ -4,7 +4,7 @@
4
4
  <% @recent_inquiries.each do |inquiry| %>
5
5
  <li class='<%= cycle("on", "on-hover", :name => 'recent_inquiries_cycle') %>'>
6
6
  <%= link_to truncate("#{inquiry.name} - #{inquiry.message}", :length => 100),
7
- admin_inquiry_url(inquiry) %>
7
+ refinery.admin_inquiry_path(inquiry) %>
8
8
  </li>
9
9
  <% end %>
10
10
  </ul>
@@ -0,0 +1,2 @@
1
+ <%= render 'recent_activity' if @recent_activity.present? %>
2
+ <%= render 'recent_inquiries' if @recent_inquiries.present? %>
@@ -1,13 +1,13 @@
1
1
  <div class='clearfix'>
2
2
  <section id='records' class='clearfix<%= ' one_list' if @recent_activity.empty? or @recent_inquiries.empty? %>'>
3
- <%= render :partial => 'records' %>
3
+ <%= render 'records' %>
4
4
  </section>
5
5
  <aside id='actions'>
6
6
  <h2><%= t('.quick_tasks') %></h2>
7
- <%= render :partial => 'actions' %>
7
+ <%= render 'actions' %>
8
8
  </aside>
9
9
  </div>
10
10
  <% if request.env["HTTP_USER_AGENT"] =~ /MSIE/ and
11
- RefinerySetting.find_or_set(:show_internet_explorer_upgrade_message, true, :scoping => 'refinery') %>
12
- <% flash.now[:message] = render(:partial => "/shared/ie6check") %>
11
+ Refinery::Core.show_internet_explorer_upgrade_message %>
12
+ <% flash.now[:message] = render(:partial => "/refinery/ie6check") %>
13
13
  <% end %>
@@ -3,14 +3,14 @@ xml.rss :version => "2.0", "xmlns:atom" => "http://www.w3.org/2005/Atom" do
3
3
  xml.channel do
4
4
  # Required to pass W3C validation.
5
5
  xml.atom :link, nil, {
6
- :href => admin_dashboard_index_path(:format => 'rss'),
6
+ :href => refinery.admin_dashboard_index_path(:format => 'rss'),
7
7
  :rel => 'self', :type => 'application/rss+xml'
8
8
  }
9
9
 
10
10
  # Feed basics.
11
11
  xml.title "Refinery Updates"
12
12
  xml.description "See the recent activity on your Refinery site."
13
- xml.link admin_dashboard_index_path(:format => 'rss')
13
+ xml.link refinery.admin_dashboard_index_path(:format => 'rss')
14
14
 
15
15
  # Recent activity.
16
16
  @recent_activity.each do |change|
@@ -1,26 +1,27 @@
1
1
  bg:
2
- plugins:
3
- refinery_dashboard:
4
- title: Табло
5
- description: Преглед на дейността в Refinery
6
- admin:
7
- dashboard:
8
- index:
9
- quick_tasks: Бърз достъп до задачи
10
- actions:
11
- add_a_new_page: Добавяне на нова страница
12
- update_a_page: Редактиране на страница
13
- upload_a_image: Качване на изображение
14
- upload_a_file: Качване на файл
15
- change_language: Смяна на език
16
- see_home_page: Преглед на началната страница
17
- recent_activity:
18
- empty: Скоро не е извършвана дейност.
19
- latest_activity: Последни действия
20
- latest_activity_message: 'Елемента "%{what}(%{kind})" бе %{action}'
21
- recent_inquiries:
22
- latest_inquiries: Последни запитвания
23
- updated:
24
- 'with_article "the"': актуализиран
25
- created:
26
- 'with_article "the"': добавен
2
+ refinery:
3
+ plugins:
4
+ refinery_dashboard:
5
+ title: Табло
6
+ description: Преглед на дейността в Refinery
7
+ admin:
8
+ dashboard:
9
+ index:
10
+ quick_tasks: Бърз достъп до задачи
11
+ actions:
12
+ add_a_new_page: Добавяне на нова страница
13
+ update_a_page: Редактиране на страница
14
+ upload_a_image: Качване на изображение
15
+ upload_a_file: Качване на файл
16
+ change_language: Смяна на език
17
+ see_home_page: Преглед на началната страница
18
+ recent_activity:
19
+ empty: Скоро не е извършвана дейност.
20
+ latest_activity: Последни действия
21
+ latest_activity_message: 'Елемента "%{what}(%{kind})" бе %{action}'
22
+ recent_inquiries:
23
+ latest_inquiries: Последни запитвания
24
+ updated:
25
+ 'with_article "the"': актуализиран
26
+ created:
27
+ 'with_article "the"': добавен
@@ -1,26 +1,27 @@
1
1
  cs:
2
- plugins:
3
- refinery_dashboard:
4
- title: Nástěnka
5
- description: Přehled akcí provedených v administraci
6
- admin:
7
- dashboard:
8
- index:
9
- quick_tasks: Rychlé příkazy
10
- actions:
11
- add_a_new_page: Přidat novou stránku
12
- update_a_page: Upravit stránku
13
- upload_a_image: Nahrát obrázek
14
- upload_a_file: Nahrát soubor
15
- change_language: Změnit jazyk
16
- see_home_page: Zobrazit titulní stránku
17
- recent_activity:
18
- empty: V poslední době nebyla provedena žádná akce.
19
- latest_activity: Nejnovější akce
20
- latest_activity_message: '%{what} %{kind} byla %{action}'
21
- recent_inquiries:
22
- latest_inquiries: Nejnovější dotazy z webu
23
- updated:
24
- 'with_article "the"': upraven
25
- created:
26
- 'with_article "the"': přidán
2
+ refinery:
3
+ plugins:
4
+ refinery_dashboard:
5
+ title: Nástěnka
6
+ description: Přehled akcí provedených v administraci
7
+ admin:
8
+ dashboard:
9
+ index:
10
+ quick_tasks: Rychlé příkazy
11
+ actions:
12
+ add_a_new_page: Přidat novou stránku
13
+ update_a_page: Upravit stránku
14
+ upload_a_image: Nahrát obrázek
15
+ upload_a_file: Nahrát soubor
16
+ change_language: Změnit jazyk
17
+ see_home_page: Zobrazit titulní stránku
18
+ recent_activity:
19
+ empty: V poslední době nebyla provedena žádná akce.
20
+ latest_activity: Nejnovější akce
21
+ latest_activity_message: '%{what} %{kind} byla %{action}'
22
+ recent_inquiries:
23
+ latest_inquiries: Nejnovější dotazy z webu
24
+ updated:
25
+ 'with_article "the"': upraven
26
+ created:
27
+ 'with_article "the"': přidán
@@ -1,26 +1,27 @@
1
1
  da:
2
- plugins:
3
- refinery_dashboard:
4
- title: Overblik
5
- description: Giver et overblik over aktiviteterne i Refinery
6
- admin:
7
- dashboard:
8
- index:
9
- quick_tasks: Handlinger
10
- actions:
11
- add_a_new_page: Tilføj en ny side
12
- update_a_page: Redigér en side
13
- upload_a_image: Upload et billede
14
- upload_a_file: Upload en fil
15
- change_language: Skift sprog
16
- see_home_page: Vis forside
17
- recent_activity:
18
- empty: Der her ingen aktititeter været for nylig.
19
- latest_activity: Seneste Aktiviteter
20
- latest_activity_message: '%{what} %{kind} blev %{action}'
21
- recent_inquiries:
22
- latest_inquiries: Seneste Henvendelser
23
- updated:
24
- 'with_article "the"': opdateret
25
- created:
26
- 'with_article "the"': oprettet
2
+ refinery:
3
+ plugins:
4
+ refinery_dashboard:
5
+ title: Overblik
6
+ description: Giver et overblik over aktiviteterne i Refinery
7
+ admin:
8
+ dashboard:
9
+ index:
10
+ quick_tasks: Handlinger
11
+ actions:
12
+ add_a_new_page: Tilføj en ny side
13
+ update_a_page: Redigér en side
14
+ upload_a_image: Upload et billede
15
+ upload_a_file: Upload en fil
16
+ change_language: Skift sprog
17
+ see_home_page: Vis forside
18
+ recent_activity:
19
+ empty: Der her ingen aktititeter været for nylig.
20
+ latest_activity: Seneste Aktiviteter
21
+ latest_activity_message: '%{what} %{kind} blev %{action}'
22
+ recent_inquiries:
23
+ latest_inquiries: Seneste Henvendelser
24
+ updated:
25
+ 'with_article "the"': opdateret
26
+ created:
27
+ 'with_article "the"': oprettet
@@ -1,26 +1,27 @@
1
1
  de:
2
- plugins:
3
- refinery_dashboard:
4
- title: Übersicht
5
- description: Gibt eine Übersicht über Aktivitäten in Refinery
6
- admin:
7
- dashboard:
8
- index:
9
- quick_tasks: Allgemeine Aufgaben
10
- actions:
11
- add_a_new_page: Neue Seite erstellen
12
- update_a_page: Eine Seite aktualisieren
13
- upload_a_image: Ein Bild hochladen
14
- upload_a_file: Eine Datei hochladen
15
- change_language: Sprache wechseln
16
- see_home_page: Homepage ansehen
17
- recent_activity:
18
- empty: Zuletzt gab es keine Aktivitäten.
19
- latest_activity: Letzte Aktivität
20
- latest_activity_message: '%{what} %{kind} wurde %{action}'
21
- recent_inquiries:
22
- latest_inquiries: Letzte Anfragen
23
- updated:
24
- 'with_article "the"': aktualisiert
25
- created:
26
- 'with_article "the"': erstellt
2
+ refinery:
3
+ plugins:
4
+ refinery_dashboard:
5
+ title: Übersicht
6
+ description: Gibt eine Übersicht über Aktivitäten in Refinery
7
+ admin:
8
+ dashboard:
9
+ index:
10
+ quick_tasks: Allgemeine Aufgaben
11
+ actions:
12
+ add_a_new_page: Neue Seite erstellen
13
+ update_a_page: Eine Seite aktualisieren
14
+ upload_a_image: Ein Bild hochladen
15
+ upload_a_file: Eine Datei hochladen
16
+ change_language: Sprache wechseln
17
+ see_home_page: Homepage ansehen
18
+ recent_activity:
19
+ empty: Zuletzt gab es keine Aktivitäten.
20
+ latest_activity: Letzte Aktivität
21
+ latest_activity_message: '%{what} %{kind} wurde %{action}'
22
+ recent_inquiries:
23
+ latest_inquiries: Letzte Anfragen
24
+ updated:
25
+ 'with_article "the"': aktualisiert
26
+ created:
27
+ 'with_article "the"': erstellt
@@ -1,26 +1,27 @@
1
1
  el:
2
- plugins:
3
- refinery_dashboard:
4
- title: Πανόπτης
5
- description: Περίληψη δραστηριοτήτων στο Refinery
6
- admin:
7
- dashboard:
8
- index:
9
- quick_tasks: Γρήγορες ενέργειες
10
- actions:
11
- add_a_new_page: Προσθήκη σελίδας
12
- update_a_page: Ενημέρωση σελίδας
13
- upload_a_image: Μεταφόρτωση εικόνας
14
- upload_a_file: Μεταφόρτωση αρχείου
15
- change_language: Επιλογή γλώσσας
16
- see_home_page: Προβολή αρχικής
17
- recent_activity:
18
- empty: Δεν υπάρχει πρόσφατη δραστηριότητα.
19
- latest_activity: Τελευταίες δραστηριότητες
20
- latest_activity_message: '%{what} %{kind} ήταν %{action}'
21
- recent_inquiries:
22
- latest_inquiries: Τελευταία μηνύματα
23
- updated:
24
- 'with_article "the"': ενημερώθηκε
25
- created:
26
- 'with_article "the"': προστέθηκε
2
+ refinery:
3
+ plugins:
4
+ refinery_dashboard:
5
+ title: Πανόπτης
6
+ description: Περίληψη δραστηριοτήτων στο Refinery
7
+ admin:
8
+ dashboard:
9
+ index:
10
+ quick_tasks: Γρήγορες ενέργειες
11
+ actions:
12
+ add_a_new_page: Προσθήκη σελίδας
13
+ update_a_page: Ενημέρωση σελίδας
14
+ upload_a_image: Μεταφόρτωση εικόνας
15
+ upload_a_file: Μεταφόρτωση αρχείου
16
+ change_language: Επιλογή γλώσσας
17
+ see_home_page: Προβολή αρχικής
18
+ recent_activity:
19
+ empty: Δεν υπάρχει πρόσφατη δραστηριότητα.
20
+ latest_activity: Τελευταίες δραστηριότητες
21
+ latest_activity_message: '%{what} %{kind} ήταν %{action}'
22
+ recent_inquiries:
23
+ latest_inquiries: Τελευταία μηνύματα
24
+ updated:
25
+ 'with_article "the"': ενημερώθηκε
26
+ created:
27
+ 'with_article "the"': προστέθηκε