refinerycms-pages 2.0.8 → 2.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,6 +27,43 @@ module Refinery
27
27
  render :layout => false
28
28
  end
29
29
 
30
+ def update
31
+ if @page.update_attributes(params[:page])
32
+ flash.notice = t(
33
+ 'refinery.crudify.updated',
34
+ :what => "'#{@page.title}'"
35
+ )
36
+
37
+ unless from_dialog?
38
+ unless params[:continue_editing] =~ /true|on|1/
39
+ redirect_back_or_default(refinery.admin_pages_path)
40
+ else
41
+ unless request.xhr?
42
+ redirect_to :back
43
+ else
44
+ render :partial => 'save_and_continue_callback', :locals => {
45
+ :new_refinery_page_path => refinery.admin_page_path(@page.uncached_nested_url),
46
+ :new_page_path => refinery.preview_page_path(@page.uncached_nested_url)
47
+ }
48
+ end
49
+ end
50
+ else
51
+ self.index
52
+ @dialog_successful = true
53
+ render :index
54
+ end
55
+ else
56
+ unless request.xhr?
57
+ render :action => 'edit'
58
+ else
59
+ render :partial => '/refinery/admin/error_messages', :locals => {
60
+ :object => @page,
61
+ :include_object_name => true
62
+ }
63
+ end
64
+ end
65
+ end
66
+
30
67
  protected
31
68
 
32
69
  def find_page
@@ -102,7 +102,7 @@ module Refinery
102
102
  end
103
103
 
104
104
  def write_cache?
105
- if Refinery::Pages.cache_pages_full
105
+ if Refinery::Pages.cache_pages_full && !refinery_user?
106
106
  cache_page(response.body, File.join('', 'refinery', 'cache', 'pages', request.path.sub("//", "/")).to_s)
107
107
  end
108
108
  end
@@ -58,8 +58,7 @@ module Refinery
58
58
  before_save { |m| m.translation.save }
59
59
  before_create :ensure_locale, :if => proc { ::Refinery.i18n_enabled? }
60
60
  before_destroy :deletable?
61
- after_save :reposition_parts!, :invalidate_cached_urls, :expire_page_caching
62
- after_update :invalidate_cached_urls
61
+ after_save :reposition_parts!, :expire_page_caching
63
62
  after_destroy :expire_page_caching
64
63
 
65
64
  class << self
@@ -187,12 +186,6 @@ module Refinery
187
186
  return true # so that other callbacks process.
188
187
  end
189
188
  end
190
-
191
- def rebuild_with_invalidate_cached_urls!
192
- rebuild_without_invalidate_cached_urls!
193
- find_each { |page| page.send :invalidate_cached_urls }
194
- end
195
- alias_method_chain :rebuild!, :invalidate_cached_urls
196
189
  end
197
190
 
198
191
  # The canonical page for this particular page.
@@ -441,17 +434,6 @@ module Refinery
441
434
  alias_method_chain :normalize_friendly_id, :marketable_urls
442
435
 
443
436
  private
444
- def invalidate_cached_urls
445
- return true unless Refinery::Pages.marketable_urls
446
-
447
- [self, children].flatten.each do |page|
448
- ((Refinery.i18n_enabled? && Refinery::I18n.frontend_locales) || [::I18n.locale]).each do |locale|
449
- Rails.cache.delete(page.url_cache_key(locale))
450
- Rails.cache.delete(page.path_cache_key(locale))
451
- end
452
- end
453
- end
454
- alias_method :invalidate_child_cached_url, :invalidate_cached_urls
455
437
 
456
438
  # Make sures that a translation exists for this page.
457
439
  # The translation is set to the default frontend locale.
@@ -36,6 +36,7 @@
36
36
 
37
37
  <% content_for :javascripts do %>
38
38
  <script>
39
+ var refinery_page_preview_url = '<%= @page.persisted? ? refinery.preview_page_path(@page.uncached_nested_url) : refinery.preview_pages_path %>';
39
40
  $(document).ready(function(){
40
41
  page_options.init(
41
42
  <%= Refinery::Pages.new_page_parts.to_s %>
@@ -48,7 +49,7 @@
48
49
  var prev_url = form.attr('action');
49
50
  var prev_target = form.attr('target');
50
51
  form.attr({
51
- 'action': '<%= @page.persisted? ? refinery.preview_page_path(@page.uncached_nested_url) : refinery.preview_pages_path %>'
52
+ 'action': refinery_page_preview_url
52
53
  , 'target': '_blank'
53
54
  });
54
55
  form.submit();
@@ -2,7 +2,7 @@
2
2
  <% if (locales ||= Refinery::I18n.frontend_locales).present? and locales.many? %>
3
3
  <ul id='switch_locale_picker' class='clearfix'>
4
4
  <% locales.each do |locale| %>
5
- <li<%= " class='selected'" if locale.to_s == local_assigns[:current_locale].to_s %>>
5
+ <li<%= " class='selected'".html_safe if locale.to_s == local_assigns[:current_locale].to_s %>>
6
6
  <%= link_to refinery_icon_tag("flags/#{locale}.png", :size => "32x22"),
7
7
  refinery.url_for(:switch_locale => locale) %>
8
8
  </li>
@@ -1,5 +1,5 @@
1
1
  <div class='page_part' id='<%= new_part ? "page_part_new_#{part_index}" : part.to_param %>'>
2
2
  <%= hidden_field_tag "page[parts_attributes][#{part_index}][title]", part.title if new_part %>
3
- <%= text_area_tag "page[parts_attributes][#{part_index}][body]", sanitize(part.body), :rows => 20, :class => 'wymeditor widest' %>
3
+ <%= text_area_tag "page[parts_attributes][#{part_index}][body]", part.body, :rows => 20, :class => 'wymeditor widest' %>
4
4
  <%= hidden_field_tag "page[parts_attributes][#{part_index}][position]", part_index %>
5
5
  </div>
@@ -0,0 +1,3 @@
1
+ <%= render '/refinery/message' %>
2
+ <%= hidden_field_tag 'new_action', local_assigns[:new_refinery_page_path] %>
3
+ <script>refinery_page_preview_url = '<%= local_assigns[:new_page_path] %>';</script>
@@ -1,31 +1,31 @@
1
- <div class='clearfix dialog_link_to'>
2
- <div id='dialog_menu_left'>
3
- <span id='your_page_radio' class='radio<%= " selected_radio" if @page_area_selected %>'>
4
- <input type='radio' name='link_to' value='your_page' id='link_to_your_page' <%= "checked='true'" if @page_area_selected %> />
5
- <label for='link_to_your_page' class='stripped'><%= t('.your_page.tab_name') %></label>
1
+ <div class="clearfix dialog_link_to">
2
+ <div id="dialog_menu_left">
3
+ <span id="your_page_radio" class="radio<%= ' selected_radio' if @page_area_selected %>">
4
+ <input type="radio" name="link_to" value="your_page" id="link_to_your_page" <%= 'checked="true"'.html_safe if @page_area_selected %> />
5
+ <label for="link_to_your_page" class="stripped"><%= t('.your_page.tab_name') %></label>
6
6
  </span>
7
- <span id='web_address_radio' class='radio<%= " selected_radio" if @web_address_area_selected %>'>
8
- <input type='radio' name='link_to' value='web_address' id='link_to_web_address' <%= "checked='true'" if @web_address_area_selected %> />
9
- <label for='link_to_web_address' class='stripped'><%= t('tab_name', :scope => 'refinery.admin.pages_dialogs.link_to.web_address') %></label>
7
+ <span id="web_address_radio" class="radio<%= ' selected_radio' if @web_address_area_selected %>">
8
+ <input type="radio" name="link_to" value="web_address" id="link_to_web_address" <%= 'checked="true"'.html_safe if @web_address_area_selected %> />
9
+ <label for="link_to_web_address" class="stripped"><%= t('tab_name', :scope => 'refinery.admin.pages_dialogs.link_to.web_address') %></label>
10
10
  </span>
11
11
 
12
- <span id='email_address_radio' class='radio<%= " selected_radio" if @email_address_area_selected %>'>
13
- <input type='radio' name='link_to' value='email_address' id='link_to_email_address' <%= "checked='true'" if @email_address_area_selected %> />
14
- <label for='link_to_email_address' class='stripped'><%= t('tab_name', :scope => 'refinery.admin.pages_dialogs.link_to.email_address') %></label>
12
+ <span id="email_address_radio" class="radio<%= ' selected_radio' if @email_address_area_selected %>">
13
+ <input type="radio" name="link_to" value="email_address" id="link_to_email_address" <%= 'checked="true"'.html_safe if @email_address_area_selected %> />
14
+ <label for="link_to_email_address" class="stripped"><%= t('tab_name', :scope => 'refinery.admin.pages_dialogs.link_to.email_address') %></label>
15
15
  </span>
16
16
  <% if ::Refinery::Plugins.registered.names.include?("refinery_files") and @resources.any? %>
17
- <span id="resource_file_radio" class="radio<%= " selected_radio" if @resource_area_selected %>">
18
- <input type="radio" name="link_to" value="resource_file" id="link_to_resource_file" <%= "checked='true'" if @resource_area_selected %> />
17
+ <span id="resource_file_radio" class="radio<%= ' selected_radio' if @resource_area_selected %>">
18
+ <input type="radio" name="link_to" value="resource_file" id="link_to_resource_file" <%= 'checked="true"'.html_safe if @resource_area_selected %> />
19
19
  <label for="link_to_resource_file" class="stripped"><%= t('tab_name', :scope => 'refinery.admin.pages_dialogs.link_to.your_resource') %></label>
20
20
  </span>
21
21
  <% end %>
22
22
  </div>
23
23
 
24
- <div id='dialog_main'>
25
- <div id='your_page_area' class='dialog_area' <%= "style='display: none'" unless @page_area_selected %>>
26
- <input type='hidden' name='selected_image' id='selected_image' />
27
- <div id='your_page_content' class='clearfix'>
28
- <div id='pages_list' class='pages_list'>
24
+ <div id="dialog_main">
25
+ <div id="your_page_area" class="dialog_area" <%= ' class="linked"'.html_safe unless @page_area_selected %>>
26
+ <input type="hidden" name="selected_image" id="selected_image" />
27
+ <div id="your_page_content" class="clearfix">
28
+ <div id="pages_list" class="pages_list">
29
29
  <ul class="link_list">
30
30
  <%= render :partial => 'page_link', :collection => @pages,
31
31
  :locals => {
@@ -37,13 +37,13 @@
37
37
  </div>
38
38
  </div>
39
39
  </div>
40
- <div id='web_address_area' <%= "style='display: none'" unless @web_address_area_selected %> class='dialog_area'>
41
- <div id='web_address_content'>
42
- <label for='web_address_text'><%= t('location', :scope => 'refinery.admin.pages_dialogs.link_to.web_address') %></label>
40
+ <div id="web_address_area" <%= 'style="display: none"'.html_safe unless @web_address_area_selected %> class="dialog_area">
41
+ <div id="web_address_content">
42
+ <label for="web_address_text"><%= t('location', :scope => 'refinery.admin.pages_dialogs.link_to.web_address') %></label>
43
43
  <%= text_field :web_address, :text, :value => @web_address_text, :style => "width: 70%" %>
44
44
  <label><%= t('new_window', :scope => 'refinery.admin.pages_dialogs.link_to.web_address') %></label>
45
- <input type='checkbox' name='web_address_target_blank' id='web_address_target_blank' <%= "checked='checked'" if @web_address_target_blank %> />
46
- <label for='web_address_target_blank' class='stripped'><%= t('new_window_label', :scope => 'refinery.admin.pages_dialogs.link_to.web_address') %></label>
45
+ <input type="checkbox" name="web_address_target_blank" id="web_address_target_blank" <%= 'checked="checked"'.html_safe if @web_address_target_blank %> />
46
+ <label for="web_address_target_blank" class="stripped"><%= t('new_window_label', :scope => 'refinery.admin.pages_dialogs.link_to.web_address') %></label>
47
47
  <p>
48
48
  <strong><%= t('not_sure', :scope => 'refinery.admin.pages_dialogs.link_to.web_address') %></strong>
49
49
  </p>
@@ -53,20 +53,20 @@
53
53
  </ol>
54
54
  </div>
55
55
  </div>
56
- <div id='email_address_area' <%= "style='display: none'" unless @email_address_area_selected %> class='dialog_area'>
57
- <div id='email_address_content'>
58
- <div class='field'>
59
- <label for='email_address_text'><%= t('tab_name', :scope => 'refinery.admin.pages_dialogs.link_to.email_address') %></label>
56
+ <div id="email_address_area" <%= 'style="display: none"'.html_safe unless @email_address_area_selected %> class="dialog_area">
57
+ <div id="email_address_content">
58
+ <div class="field">
59
+ <label for="email_address_text"><%= t('tab_name', :scope => 'refinery.admin.pages_dialogs.link_to.email_address') %></label>
60
60
  <%= text_field :email_address, :text, :value => @email_address_text, :style => "width: 70%" %>
61
61
  </div>
62
62
 
63
- <div class='field'>
64
- <label for='email_default_subject_text'><%= t('subject_line_optional', :scope => 'refinery.admin.pages_dialogs.link_to.email_address') %></label>
63
+ <div class="field">
64
+ <label for="email_default_subject_text"><%= t('subject_line_optional', :scope => 'refinery.admin.pages_dialogs.link_to.email_address') %></label>
65
65
  <%= text_field :email_default_subject, :text, :value => @email_default_subject_text, :style => "width: 70%" %>
66
66
  </div>
67
67
 
68
- <div class='field'>
69
- <label for='email_default_body_text'><%= t('body_optional', :scope => 'refinery.admin.pages_dialogs.link_to.email_address') %></label>
68
+ <div class="field">
69
+ <label for="email_default_body_text"><%= t('body_optional', :scope => 'refinery.admin.pages_dialogs.link_to.email_address') %></label>
70
70
  <%= text_area :email_default_body, :text, :value => @email_default_body_text, :style => "width: 70%", :rows => '' %>
71
71
  </div>
72
72
 
@@ -87,12 +87,12 @@
87
87
  </div>
88
88
  </div>
89
89
  <% if ::Refinery::Plugins.registered.names.include?("refinery_files") and @resources.any? %>
90
- <div id="resource_file_area"<%= " style='display:none'" unless @resource_area_selected %> class="dialog_area">
91
- <div id='resources_list' class='pages_list'>
90
+ <div id="resource_file_area"<%= ' style="display:none"'.html_safe unless @resource_area_selected %> class="dialog_area">
91
+ <div id="resources_list" class="pages_list">
92
92
  <ul class="link_list">
93
93
  <% @resources.each do |resource| -%>
94
94
  <% resource_linked = (resource.url == params[:current_link]) unless params[:current_link].blank? %>
95
- <li<%= " class='linked'" if resource_linked %>>
95
+ <li<%= ' class="linked"'.html_safe if resource_linked %>>
96
96
  <%= link_to "#{resource.title}.#{resource.ext}", asset_paths.compute_public_path(resource.url, ''),
97
97
  :title => t('link_to_this_resource', :scope => 'refinery.admin.pages_dialogs.link_to.your_resource'),
98
98
  :rel => resource.title,
@@ -39,6 +39,9 @@ es:
39
39
  view_live_html: Ver esta página como abierta al público<br/><em>(la abre en ventana nueva)</em>
40
40
  hidden: oculta
41
41
  draft: borrador
42
+ form:
43
+ preview: Previsualizar
44
+ preview_changes: Previsualizar cambios antes de guardarlos
42
45
  form_new_page_parts:
43
46
  title: Título
44
47
  form_page_parts:
@@ -50,6 +53,7 @@ es:
50
53
  parent_page: Página padre
51
54
  advanced_options: Opciones avanzadas
52
55
  custom_title: Título personalizado
56
+ menu_title: Título del menú
53
57
  show_in_menu_title: Ver en menú
54
58
  show_in_menu_description: Mostrar esta página en el menú de la web
55
59
  show_in_menu_help: Deja sin marcar esta casilla para eliminar una página del menú de tu web. Puede ser útil si tienes una página que quieres que la gente enlace directamente pero no quieres mostrarla en el menú.
@@ -47,14 +47,16 @@ fr:
47
47
  title: Titre
48
48
  form_page_parts:
49
49
  create_content_section: Créer une nouvelle section de contenu
50
- delete_content_section: Supprimer une section
50
+ delete_content_section: Supprimer une section de contenu
51
+ reorder_content_section: Réordonner les sections de contenu
52
+ reorder_content_section_done: J'ai terminé de réordonner les sections de contenu
51
53
  form_advanced_options:
52
54
  toggle_advanced_options: Cliquer ici pour paraméter les étiquettes et accéder au menu des options
53
55
  page_options: Page Options
54
56
  parent_page: Page parente
55
57
  advanced_options: Options avancées
56
58
  menu_title: Titre dans le menu
57
- custom_title: Titre personnalisé
59
+ custom_slug: Slug personnalisé
58
60
  show_in_menu_title: Placer dans le menu
59
61
  show_in_menu_description: Placer cette page dans le menu du site
60
62
  show_in_menu_help: Décochez cette case si vous souhaitez supprimer une page du menu de votre site. Ceci peut être utile si vous voulez diriger les utilisateurs directement vers une page, sans qu'elle n'apparaisse dans le menu.
@@ -66,13 +68,26 @@ fr:
66
68
  link_url_help: "Si vous souhaitez que cette page mène à un autre site internet ou à une autre page lorsque l'on clique dessus dans le menu, entrez une URL '(par exemple http://google.com)'. Sinon laissez ce champ vide."
67
69
  parent_page_help: "Vous pouvez placer une page sous une autre page en la sélectionnant dans la liste. Si vous voulez que cette page soit une page parente, laissez ce champ vide."
68
70
  menu_title_help: Si vous voulez que le menu affiche un titre différent que celui qui sera affiché sur la page, entrez-le ici.
69
- custom_title_help: "Si vous voulez que la page ait un titre différent de celui qui apparaît dans le menu, sélectionnez &apos;Text&apos; et entrez-le ici."
71
+ custom_slug_help: Un slug est un identifiant plus humain utilisé dans l'adresse d'une page, par exemple &apos;a-propos&apos;. Pour écraser le slug généré automatiquement par Refinery, entrez votre slug personnalisé ici.
72
+ layout_template: Agencement
73
+ layout_template_help: Vous pouvez choisir un agencement différent pour cette page
74
+ view_template: Modèle de vue
75
+ view_template_help: Vous pouvez choisir un différent modèle de vue pour cette page
76
+ form_advanced_options_seo:
77
+ seo: Search Engine Optimization
78
+ seo_override_title: Titre du navigateur
79
+ seo_override_title_help: Saisissez 5 à 10 mots qui résument le contenu de cette page.
80
+ meta_keywords_title: Meta keywords
81
+ meta_keywords_help: Saisissez 5 à 10 mots-clés se rapportant à cette page. Séparez les mots-clés par une virgule.
82
+ meta_description_title: Meta description
83
+ meta_description_help: Entrez deux ou trois phrases concises décrivant ce à quoi cette page est consacrée.
70
84
  actions:
71
85
  create_new_page: Créer une nouvelle page
72
86
  reorder_pages: Réordonner les pages
73
87
  reorder_pages_done: Fin de réordonnancement des pages
74
88
  records:
75
89
  no_pages_yet: "Il n'y a actuellement aucune page. Cliquer sur 'Créer une nouvelle page' pour en ajouter une."
90
+ translator_access: Vous n'avez pas les permissions requises pour modifier les pages dans cette langue.
76
91
  activerecord:
77
92
  models:
78
93
  refinery/page: page
@@ -34,21 +34,29 @@ sk:
34
34
  pages:
35
35
  delete: Zmazať túto stránku
36
36
  edit: Upraviť túto stránku
37
+ new: Pridať novú podstránku
38
+ expand_collapse: Rozbaliť alebo zbaliť podstránky
37
39
  page:
38
40
  view_live_html: Zobraziť stránku <br/><em>(otvorí sa v novom okne)</em>
39
41
  hidden: skrytá
40
42
  draft: pracovná verzia
43
+ form:
44
+ preview: Náhľad
45
+ preview_changes: Zobraziť náhľad s vykonanými zmenami
41
46
  form_new_page_parts:
42
47
  title: Názov
43
48
  form_page_parts:
44
49
  create_content_section: Pridať sekciu
45
50
  delete_content_section: Zmazať sekciu
51
+ reorder_content_section: Preusporiadať sekcie
52
+ reorder_content_section_done: Uložiť usporiadanie sekcií
46
53
  form_advanced_options:
47
54
  toggle_advanced_options: Sprístupní nastavenia menu a meta tagov.
48
55
  page_options: Nastavenie stránky
49
56
  parent_page: Nadradená stránka
50
57
  advanced_options: Rozšírené nastavenia
51
- custom_title: Titulok
58
+ menu_title: Názov menu
59
+ custom_slug: Vlastný url identifikátor
52
60
  show_in_menu_title: Zobraziť v menu
53
61
  show_in_menu_description: Zobraziť túto stránku v menu webu
54
62
  show_in_menu_help: Odznačte ak chcete odstrániť odkaz na túto stránku z menu webu. Toto je užitočné ak máte stránku, na ktorú chcete mať priamy odkaz, ale nechcete zobrazovať stránku v menu.
@@ -59,13 +67,27 @@ sk:
59
67
  link_url: Presmerovať túto stránku na iný web alebo stránku.
60
68
  link_url_help: Ak chcete, aby po kliknutí na odkaz na tútu stránku bol návštevník presmerovaný na iný web, vložte adresu (napr. http://google.com), inak ponechajte prázdne.
61
69
  parent_page_help: Môžete umiestniť túto stránku v hierarchii pod inú stránku. Ak nevyberiete nič, bude táto stránka umiestnená na prvej úrovni.
62
- custom_title_help: Ak chcete aby stránka mala iný titulok než ten ktorý sa zobrazuje v menu vyberte &apos;Text&apos; a vložte ho tu.
70
+ menu_title_help: Ak chcete, aby sa v menu zobrazil odlišný názov ako ten, ktorý sa zobrazuje na stránke, napíšte ho sem.
71
+ custom_slug_help: Url identifikátor je človekom čitateľný identifikátor, ktorý sa používa na vytvorenie celej url adresy stránky, napríklad &apos;o-nas&apos;. Ak chcete zmeniť url identifikátor, ktorý automaticky vytvorí Refinery, napíšte váš vlastný url identifikátor sem.
72
+ layout_template: Šablóny rozmiestnenia
73
+ layout_template_help: Pre túto stránku si môžete vybrať odlišnú šablónu rozmiestnenia.
74
+ view_template: Šablóny vzhľadu
75
+ view_template_help: Pre túto stránku si môžete vybrať odlišnú šablónu vzhľadu.
76
+ form_advanced_options_seo:
77
+ seo: Optimalizácia pre vyhľadávače
78
+ seo_override_title: Titulok prehliadača
79
+ seo_override_title_help: Vložte titulok dĺžky 5-10 slov, ktorý vystihuje obsah stránky.
80
+ meta_keywords_title: Kľúčové slová (Meta keywords)
81
+ meta_keywords_help: Vložte 5-10 kľúčových slov oddelených čiarkov, ktoré sa vzťahujú k obsahu stránky.
82
+ meta_description_title: Popis (Meta description)
83
+ meta_description_help: Vložte 2-3 krátke vety sumarizujúce obsah stránky.
63
84
  actions:
64
85
  create_new_page: Pridať novú stránku
65
86
  reorder_pages: Zmeniť usporiadanie stránok
66
87
  reorder_pages_done: Uložiť usporiadanie
67
88
  records:
68
89
  no_pages_yet: Zatiaľ neboli vytvorené žiadne stránky. Kliknite na "Pridať novú stránku" pre pridanie prvej.
90
+ translator_access: Nemáte požadované oprávnenia editovať stránky v tomto jazyku
69
91
  activerecord:
70
92
  models:
71
93
  refinery/page: stránka
@@ -42,7 +42,10 @@ end
42
42
 
43
43
  (Refinery.i18n_enabled? ? Refinery::I18n.frontend_locales : [:en]).each do |lang|
44
44
  I18n.locale = lang
45
- Refinery::Page.find_by_title("Home").update_attributes(:slug => "home")
46
- Refinery::Page.find_by_title("Page not found").update_attributes(:slug => "page-not-found")
47
- Refinery::Page.find_by_title("About").update_attributes(:slug => "about")
45
+ {'home' => "Home",
46
+ 'page-not-found' => 'Page not found',
47
+ 'about' => 'About'
48
+ }.each do |slug, title|
49
+ Refinery::Page.by_title(title).each { |page| page.update_attributes(:slug => slug) }
50
+ end
48
51
  end
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  Refinery::Pages.configure do |config|
2
3
  # Configure specific page templates
3
4
  # config.types.register :home do |home|
@@ -10,11 +10,10 @@ Gem::Specification.new do |s|
10
10
  s.version = version
11
11
  s.summary = %q{Pages extension for Refinery CMS}
12
12
  s.description = %q{The default content extension of Refinery CMS. This extension handles the administration and display of user-editable pages.}
13
- s.date = %q{2011-10-12}
14
13
  s.email = %q{info@refinerycms.com}
15
14
  s.homepage = %q{http://refinerycms.com}
16
15
  s.rubyforge_project = %q{refinerycms}
17
- s.authors = ['Philip Arndt', 'Uģis Ozols', 'Rob Yurkowski', 'David Jones', 'Steven Heidel']
16
+ s.authors = ['Philip Arndt', 'Uģis Ozols', 'Rob Yurkowski']
18
17
  s.license = %q{MIT}
19
18
  s.require_paths = %w(lib)
20
19
 
@@ -38,7 +38,7 @@ module Refinery
38
38
  @content.hide_sections 'bar'
39
39
  end
40
40
 
41
- # Regression for https://github.com/resolve/refinerycms/issues/1516
41
+ # Regression for https://github.com/refinery/refinerycms/issues/1516
42
42
  it "accepts an array" do
43
43
  section2.should_receive :hide
44
44
  @content.hide_sections ['bar']
@@ -8,6 +8,13 @@ def new_window_should_have_content(content)
8
8
  end
9
9
  end
10
10
 
11
+ def new_window_should_not_have_content(content)
12
+ new_window = page.driver.browser.window_handles.last
13
+ page.within_window new_window do
14
+ page.should_not have_content(content)
15
+ end
16
+ end
17
+
11
18
  module Refinery
12
19
  module Admin
13
20
  describe "Pages" do
@@ -143,19 +150,45 @@ module Refinery
143
150
  end
144
151
 
145
152
  describe "edit/update" do
146
- before { Page.create :title => "Update me" }
153
+ before do
154
+ Page.create :title => "Update me"
147
155
 
148
- it "updates page" do
149
156
  visit refinery.admin_pages_path
150
-
151
157
  page.should have_content("Update me")
158
+ end
152
159
 
153
- click_link "Edit this page"
160
+ context 'when saving and returning to index' do
161
+ it "updates page" do
162
+ click_link "Edit this page"
154
163
 
155
- fill_in "Title", :with => "Updated"
156
- click_button "Save"
164
+ fill_in "Title", :with => "Updated"
165
+ click_button "Save"
157
166
 
158
- page.should have_content("'Updated' was successfully updated.")
167
+ page.should have_content("'Updated' was successfully updated.")
168
+ end
169
+ end
170
+
171
+ context 'when saving and continuing to edit' do
172
+ before :each do
173
+ find('a[tooltip^=Edit]').visible?
174
+ find('a[tooltip^=Edit]').click
175
+
176
+ fill_in "Title", :with => "Updated"
177
+ click_button "Save & continue editing"
178
+ find('#flash').visible?
179
+ end
180
+
181
+ it "updates page", :js do
182
+ page.should have_content("'Updated' was successfully updated.")
183
+ end
184
+
185
+ # Regression test for https://github.com/refinery/refinerycms/issues/1892
186
+ context 'when saving to exit (a second time)' do
187
+ it 'updates page', :js do
188
+ click_button "Save"
189
+ page.should have_content("'Updated' was successfully updated.")
190
+ end
191
+ end
159
192
  end
160
193
  end
161
194
 
@@ -185,6 +218,22 @@ module Refinery
185
218
  Page.by_title("Some changes I'm unsure what they will look like").should be_empty
186
219
  end
187
220
 
221
+ # Regression test for previewing after save-and_continue
222
+ it 'will show the preview in a new window after save-and-continue', :js do
223
+ visit refinery.admin_pages_path
224
+
225
+ find('a[tooltip^=Edit]').click
226
+ fill_in "Title", :with => "Save this"
227
+ click_button "Save & continue editing"
228
+ page.should have_content("'Save this' was successfully updated")
229
+
230
+ click_button "Preview"
231
+
232
+ new_window_should_have_content("Save this")
233
+ new_window_should_not_have_content(
234
+ ::I18n.t('switch_to_website', :scope => 'refinery.site_bar')
235
+ )
236
+ end
188
237
  end
189
238
 
190
239
  context 'a brand new page' do
@@ -532,6 +581,24 @@ module Refinery
532
581
  end
533
582
  end
534
583
  end
584
+
585
+ # regression spec for https://github.com/refinery/refinerycms/issues/1891
586
+ describe "page part body" do
587
+ before do
588
+ page = Refinery::Page.create! :title => "test"
589
+ Refinery::Pages.default_parts.each_with_index do |default_page_part, index|
590
+ page.parts.create(:title => default_page_part,
591
+ :body => "<header class='regression'>test</header>",
592
+ :position => index)
593
+ end
594
+ end
595
+
596
+ specify "html shouldn't be stripped" do
597
+ visit refinery.admin_pages_path
598
+ click_link "Edit this page"
599
+ page.should have_content("header class='regression'")
600
+ end
601
+ end
535
602
  end
536
603
 
537
604
  describe "TranslatePages" do
@@ -643,7 +710,7 @@ module Refinery
643
710
  end
644
711
  end
645
712
 
646
- # see https://github.com/resolve/refinerycms/pull/1583
713
+ # see https://github.com/refinery/refinerycms/pull/1583
647
714
  context "when switching locales" do
648
715
  specify "dialog has correct links", :js do
649
716
  visit refinery.edit_admin_page_path(about_page)
metadata CHANGED
@@ -1,19 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms-pages
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8
4
+ version: 2.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Philip Arndt
9
9
  - Uģis Ozols
10
10
  - Rob Yurkowski
11
- - David Jones
12
- - Steven Heidel
13
11
  autorequire:
14
12
  bindir: bin
15
13
  cert_chain: []
16
- date: 2011-10-12 00:00:00.000000000 Z
14
+ date: 2012-11-21 00:00:00.000000000 Z
17
15
  dependencies:
18
16
  - !ruby/object:Gem::Dependency
19
17
  name: awesome_nested_set
@@ -54,7 +52,7 @@ dependencies:
54
52
  requirements:
55
53
  - - '='
56
54
  - !ruby/object:Gem::Version
57
- version: 2.0.8
55
+ version: 2.0.9
58
56
  type: :runtime
59
57
  prerelease: false
60
58
  version_requirements: !ruby/object:Gem::Requirement
@@ -62,7 +60,7 @@ dependencies:
62
60
  requirements:
63
61
  - - '='
64
62
  - !ruby/object:Gem::Version
65
- version: 2.0.8
63
+ version: 2.0.9
66
64
  - !ruby/object:Gem::Dependency
67
65
  name: babosa
68
66
  requirement: !ruby/object:Gem::Requirement
@@ -99,7 +97,6 @@ files:
99
97
  - app/models/refinery/page.rb
100
98
  - app/models/refinery/page_part.rb
101
99
  - app/presenters/refinery/page_presenter.rb
102
- - app/views/admin/pages/_sortable_list.html.erb
103
100
  - app/views/refinery/admin/pages/_actions.html.erb
104
101
  - app/views/refinery/admin/pages/_form.html.erb
105
102
  - app/views/refinery/admin/pages/_form_advanced_options.html.erb
@@ -111,6 +108,7 @@ files:
111
108
  - app/views/refinery/admin/pages/_page.html.erb
112
109
  - app/views/refinery/admin/pages/_page_part_field.html.erb
113
110
  - app/views/refinery/admin/pages/_records.html.erb
111
+ - app/views/refinery/admin/pages/_save_and_continue_callback.html.erb
114
112
  - app/views/refinery/admin/pages/_sortable_list.html.erb
115
113
  - app/views/refinery/admin/pages/children.html.erb
116
114
  - app/views/refinery/admin/pages/edit.html.erb
@@ -198,7 +196,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
198
196
  version: '0'
199
197
  segments:
200
198
  - 0
201
- hash: 2292200110093210993
199
+ hash: 2294357088628806628
202
200
  required_rubygems_version: !ruby/object:Gem::Requirement
203
201
  none: false
204
202
  requirements:
@@ -207,10 +205,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
205
  version: '0'
208
206
  segments:
209
207
  - 0
210
- hash: 2292200110093210993
208
+ hash: 2294357088628806628
211
209
  requirements: []
212
210
  rubyforge_project: refinerycms
213
- rubygems_version: 1.8.22
211
+ rubygems_version: 1.8.24
214
212
  signing_key:
215
213
  specification_version: 3
216
214
  summary: Pages extension for Refinery CMS
@@ -1,8 +0,0 @@
1
- <ul class='sortable_list'>
2
- <%= render :partial => 'page',
3
- :collection => @pages.select{|p| p.parent_id.nil?},
4
- :locals => {
5
- :collection => @pages
6
- } %>
7
- </ul>
8
- <%= render '/refinery/admin/sortable_list', :continue_reordering => !!local_assigns[:continue_reordering] %>