rails_admin_cms 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +36 -0
- data/Rakefile +26 -0
- data/app/assets/javascripts/rails_admin_cms/all.js.coffee +2 -0
- data/app/assets/javascripts/rails_admin_cms/cms.js.coffee +18 -0
- data/app/assets/javascripts/rails_admin_cms/cms/flashes.js.coffee +2 -0
- data/app/assets/javascripts/rails_admin_cms/cms/with_scope/forms.js.coffee +4 -0
- data/app/assets/javascripts/rails_admin_cms/cms/with_scope/viewables.js.coffee +14 -0
- data/app/assets/stylesheets/rails_admin_cms/all.css.sass +0 -0
- data/app/controllers/cms/attachments_controller.rb +20 -0
- data/app/controllers/cms/files_controller.rb +19 -0
- data/app/controllers/cms/forms_controller.rb +89 -0
- data/app/controllers/cms/pages_controller.rb +13 -0
- data/app/controllers/cms/viewables_controller.rb +49 -0
- data/app/controllers/concerns/cms/editing.rb +21 -0
- data/app/controllers/concerns/cms/localize.rb +15 -0
- data/app/helpers/cms/cache_helper.rb +26 -0
- data/app/helpers/cms/form_helper.rb +67 -0
- data/app/helpers/cms/locale_helper.rb +34 -0
- data/app/helpers/cms/view_helper.rb +37 -0
- data/app/helpers/cms/viewable_helper.rb +155 -0
- data/app/helpers/rails_admin/form_builder_decorator.rb +11 -0
- data/app/helpers/rails_admin/navigation_helper.rb +77 -0
- data/app/mailers/cms/forms_mailer.rb +48 -0
- data/app/models/admin/form/email.rb +41 -0
- data/app/models/admin/form/field.rb +25 -0
- data/app/models/admin/form/row.rb +36 -0
- data/app/models/admin/form/static/object.rb +15 -0
- data/app/models/admin/form/structure.rb +18 -0
- data/app/models/admin/setting.rb +21 -0
- data/app/models/admin/unique_key.rb +15 -0
- data/app/models/admin/viewable/block.rb +25 -0
- data/app/models/admin/viewable/form.rb +36 -0
- data/app/models/admin/viewable/image.rb +18 -0
- data/app/models/admin/viewable/link.rb +21 -0
- data/app/models/admin/viewable/page.rb +27 -0
- data/app/models/admin/viewable/select.rb +15 -0
- data/app/models/admin/viewable/text.rb +16 -0
- data/app/models/callbacks/form/field_after_create.rb +16 -0
- data/app/models/callbacks/form/field_after_destroy.rb +16 -0
- data/app/models/callbacks/form/field_before_update.rb +29 -0
- data/app/models/callbacks/restrictor.rb +30 -0
- data/app/models/callbacks/unique_key_before_update.rb +46 -0
- data/app/models/callbacks/viewable_after_destroy.rb +27 -0
- data/app/models/callbacks/viewable_before_update.rb +15 -0
- data/app/models/form.rb +43 -0
- data/app/models/form/email.rb +21 -0
- data/app/models/form/field.rb +75 -0
- data/app/models/form/row.rb +30 -0
- data/app/models/form/static.rb +17 -0
- data/app/models/form/static/attachment.rb +62 -0
- data/app/models/form/static/base.rb +10 -0
- data/app/models/form/static/email.rb +23 -0
- data/app/models/form/static/object.rb +12 -0
- data/app/models/form/structure.rb +90 -0
- data/app/models/setting.rb +85 -0
- data/app/models/unique_key.rb +62 -0
- data/app/models/viewable.rb +93 -0
- data/app/models/viewable/block.rb +39 -0
- data/app/models/viewable/field/url.rb +45 -0
- data/app/models/viewable/field/uuid.rb +61 -0
- data/app/models/viewable/form.rb +67 -0
- data/app/models/viewable/image.rb +6 -0
- data/app/models/viewable/link.rb +10 -0
- data/app/models/viewable/page.rb +24 -0
- data/app/models/viewable/select.rb +6 -0
- data/app/models/viewable/text.rb +6 -0
- data/app/presenters/base_list_presenter.rb +42 -0
- data/app/presenters/base_presenter.rb +17 -0
- data/app/presenters/viewable/block_presenter.rb +10 -0
- data/app/presenters/viewable/form_presenter.rb +15 -0
- data/app/presenters/viewable/image_presenter.rb +11 -0
- data/app/presenters/viewable/link_list_presenter.rb +44 -0
- data/app/presenters/viewable/link_presenter.rb +64 -0
- data/app/presenters/viewable/page_presenter.rb +4 -0
- data/app/presenters/viewable/select_list_presenter.rb +7 -0
- data/app/presenters/viewable/select_presenter.rb +15 -0
- data/app/presenters/viewable/text_presenter.rb +11 -0
- data/app/presenters/viewable/view_presenter.rb +38 -0
- data/app/presenters/viewable_list_presenter.rb +54 -0
- data/app/presenters/viewable_presenter.rb +27 -0
- data/app/views/cms/forms/create.js.erb +3 -0
- data/app/views/cms/shared/_flash_messages.js.erb +2 -0
- data/app/views/cms/viewables/update.js.erb +1 -0
- data/app/views/layouts/rails_admin/_secondary_navigation.html.haml +10 -0
- data/config/initializers/assets.rb +6 -0
- data/config/initializers/route_translator.rb +3 -0
- data/config/locales/cms.en.yml +32 -0
- data/config/locales/cms.fr.yml +32 -0
- data/config/locales/flash.en.yml +43 -0
- data/config/locales/flash.fr.yml +43 -0
- data/config/locales/routes.en.yml +3 -0
- data/config/locales/routes.fr.yml +3 -0
- data/config/routes.rb +36 -0
- data/config/spring.rb +1 -0
- data/db/migrate/20151226023652_create_unique_key.rb +19 -0
- data/db/migrate/20151226054335_create_viewable_link.rb +14 -0
- data/db/migrate/20151227064933_create_viewable_text.rb +10 -0
- data/db/migrate/20151227072412_create_rich_rich_images.rich.rb +18 -0
- data/db/migrate/20151227072413_add_uri_cache_to_rich_image.rich.rb +6 -0
- data/db/migrate/20151227072414_refactor_image_to_file.rich.rb +13 -0
- data/db/migrate/20151228231201_create_viewable_image.rb +10 -0
- data/db/migrate/20151230050603_create_setting.rb +13 -0
- data/db/migrate/20151230072904_add_cms_mail_from_and_bcc_settings.rb +14 -0
- data/db/migrate/20151230085947_create_viewable_select.rb +10 -0
- data/db/migrate/20151231054310_create_viewable_block.rb +9 -0
- data/db/migrate/20151231102148_create_viewable_page.rb +13 -0
- data/db/migrate/20160101124428_create_viewable_form.rb +15 -0
- data/db/migrate/20160101140244_create_form_structure.rb +9 -0
- data/db/migrate/20160101141844_create_form_row.rb +13 -0
- data/db/migrate/20160102010317_create_form_field.rb +17 -0
- data/db/migrate/20160103120544_create_form_email.rb +18 -0
- data/lib/generators/cms/install/USAGE +8 -0
- data/lib/generators/cms/install/install_generator.rb +14 -0
- data/lib/generators/cms/install/templates/Gemfile +47 -0
- data/lib/generators/cms/install/templates/app/assets/javascripts/application.js +19 -0
- data/lib/generators/cms/install/templates/app/assets/stylesheets/application.css +17 -0
- data/lib/generators/cms/install/templates/app/controllers/application_controller.rb +9 -0
- data/lib/generators/cms/install/templates/app/controllers/cms/authenticate.rb +34 -0
- data/lib/generators/cms/install/templates/app/models/form/contact.rb +20 -0
- data/lib/generators/cms/install/templates/app/views/cms/blocks/_example.html.erb +13 -0
- data/lib/generators/cms/install/templates/app/views/cms/forms/contact/_form.html.erb +30 -0
- data/lib/generators/cms/install/templates/app/views/cms/forms/contact/new.html.erb +19 -0
- data/lib/generators/cms/install/templates/app/views/cms/forms_mailer/contact.html.erb +6 -0
- data/lib/generators/cms/install/templates/app/views/cms/forms_mailer/contact.text.erb +6 -0
- data/lib/generators/cms/install/templates/app/views/cms/pages/page.html.erb +29 -0
- data/lib/generators/cms/install/templates/app/views/layouts/application.html.erb +23 -0
- data/lib/generators/cms/install/templates/config/application.rb +36 -0
- data/lib/generators/cms/install/templates/config/initializers/rails_admin.rb +97 -0
- data/lib/generators/cms/install/templates/config/initializers/rich.rb +142 -0
- data/lib/generators/cms/install/templates/config/initializers/simple_form.rb +165 -0
- data/lib/generators/cms/install/templates/config/initializers/simple_form_bootstrap.rb +149 -0
- data/lib/generators/cms/install/templates/config/locales/routes.en.yml +4 -0
- data/lib/generators/cms/install/templates/config/locales/simple_form.en.yml +31 -0
- data/lib/generators/cms/install/templates/config/routes.rb +61 -0
- data/lib/generators/cms/install/templates/vendor/assets/javascripts/rails_admin/custom/ui.js.coffee +1 -0
- data/lib/generators/cms/install/templates/vendor/assets/stylesheets/rails_admin/custom/mixins.sass +0 -0
- data/lib/generators/cms/install/templates/vendor/assets/stylesheets/rails_admin/custom/theming.sass +1 -0
- data/lib/generators/cms/install/templates/vendor/assets/stylesheets/rails_admin/custom/variables.sass +0 -0
- data/lib/generators/cms/install/templates/vendor/assets/stylesheets/rich/editor.css +20 -0
- data/lib/rails_admin_cms.rb +28 -0
- data/lib/rails_admin_cms/config.rb +45 -0
- data/lib/rails_admin_cms/core_ext/boolean.rb +29 -0
- data/lib/rails_admin_cms/engine.rb +11 -0
- data/lib/rails_admin_cms/inflections.rb +4 -0
- data/lib/rails_admin_cms/utils.rb +30 -0
- data/lib/rails_admin_cms/version.rb +3 -0
- data/lib/tasks/rails_admin_cms_tasks.rake +4 -0
- metadata +669 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
module Viewable
|
2
|
+
class LinkListPresenter < ViewableListPresenter
|
3
|
+
def wrapped_menu(name)
|
4
|
+
h.content_tag :li do
|
5
|
+
h.concat h.active_link_to(name, '#', active: active_menu?)
|
6
|
+
h.concat(h.content_tag(:ul, sortable) do
|
7
|
+
menu
|
8
|
+
end)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def menu
|
13
|
+
each do |link|
|
14
|
+
h.concat link.li_link_to_with_edit
|
15
|
+
end
|
16
|
+
h.concat(add_link) if h.cms_edit_mode?
|
17
|
+
end
|
18
|
+
|
19
|
+
def active_menu?
|
20
|
+
!!active_link
|
21
|
+
end
|
22
|
+
|
23
|
+
def active_link
|
24
|
+
@active_link ||= begin
|
25
|
+
breadcrumbs
|
26
|
+
@active_link
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def breadcrumbs
|
31
|
+
@breadcrumbs ||= begin
|
32
|
+
@active_link = nil
|
33
|
+
take_while do |link|
|
34
|
+
if link.active?
|
35
|
+
@active_link = link
|
36
|
+
false
|
37
|
+
else
|
38
|
+
true
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Viewable
|
2
|
+
class LinkPresenter < ViewablePresenter
|
3
|
+
def link_to(name = nil, options = {})
|
4
|
+
h.active_link_to *normalize_link_options(name, options)
|
5
|
+
end
|
6
|
+
|
7
|
+
def li_link_to(name = nil, options = {})
|
8
|
+
li_sortable_tag options[:li] do
|
9
|
+
h.active_link_to *normalize_link_options(name, options)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def li_link_to_with_edit(name = nil, options = {})
|
14
|
+
li_sortable_tag options[:li] do
|
15
|
+
h.concat h.active_link_to(*normalize_link_options(name, options))
|
16
|
+
h.concat edit_link
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def youtube_embed_url(width = 420, height = 315)
|
21
|
+
if (url = m.url)
|
22
|
+
link = YouTubeAddy.youtube_embed_url(url, width, height)
|
23
|
+
# verify url validity
|
24
|
+
unless link[/\[\/\^/]
|
25
|
+
link.html_safe
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def url(options = {})
|
31
|
+
@url ||= begin
|
32
|
+
if m.file.present?
|
33
|
+
h.main_app.file_path(id: m)
|
34
|
+
else
|
35
|
+
m.page.presence || m.url.presence || options[:path] || options[:url] || '#'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def active?(options = {})
|
41
|
+
@active ||= begin
|
42
|
+
path = url(options)
|
43
|
+
if path == '#' || path[/^http/]
|
44
|
+
false
|
45
|
+
else
|
46
|
+
!!(h.request.path =~ /^#{path}/)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def normalize_link_options(name, options)
|
54
|
+
name = m.title.presence || name
|
55
|
+
if m.target_blank?
|
56
|
+
options = options.merge target: '_blank'
|
57
|
+
end
|
58
|
+
if !m.turbolink?
|
59
|
+
options = options.merge 'data-no-turbolink' => true
|
60
|
+
end
|
61
|
+
[name, url(options), options]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Viewable
|
2
|
+
class ViewPresenter < ViewablePresenter
|
3
|
+
def initialize(model, context)
|
4
|
+
super
|
5
|
+
set_cms_view
|
6
|
+
set_meta_tags
|
7
|
+
end
|
8
|
+
|
9
|
+
def add_link
|
10
|
+
return unless h.cms_edit_mode?
|
11
|
+
|
12
|
+
h.link_to add_path, class: "cms-add cms-add-page", 'data-no-turbolink' => true do
|
13
|
+
h.t('cms.add_page')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def set_cms_view
|
20
|
+
h.instance_variable_set :@cms_view, self
|
21
|
+
end
|
22
|
+
|
23
|
+
def set_meta_tags
|
24
|
+
tags = %w[
|
25
|
+
title
|
26
|
+
meta_keywords
|
27
|
+
meta_description
|
28
|
+
]
|
29
|
+
tags.each do |tag|
|
30
|
+
h.instance_variable_set("@cms_page_#{tag}", m.send(tag).presence)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def add_path
|
35
|
+
h.main_app.new_viewable_url(list_key: h.cms_list_key(m.short_type, m.unique_key_name), max: Float::INFINITY)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class ViewableListPresenter < BaseListPresenter
|
2
|
+
def initialize(list, context, list_key, max)
|
3
|
+
super(list, context)
|
4
|
+
@max = max
|
5
|
+
@list_key = list_key
|
6
|
+
end
|
7
|
+
|
8
|
+
def edit_links(method_name = nil)
|
9
|
+
return unless h.cms_edit_mode?
|
10
|
+
|
11
|
+
h.content_tag(:ul, sortable(class: "cms-wrapped-edit")) do
|
12
|
+
list.each.with_index(1) do |m, i|
|
13
|
+
name = method_name ? m.__send__(method_name) : i
|
14
|
+
h.concat(h.content_tag(:li, 'data-cms-sortable-id' => m.unique_key.id) do
|
15
|
+
m.edit_link(name)
|
16
|
+
end)
|
17
|
+
end
|
18
|
+
h.concat h.content_tag(:li, add_link)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def add_link
|
23
|
+
return unless h.cms_edit_mode?
|
24
|
+
return unless @max == Float::INFINITY || list.size < @max.to_i
|
25
|
+
|
26
|
+
h.link_to add_path, class: "cms-add", 'data-no-turbolink' => true do
|
27
|
+
h.t('cms.add')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def sortable(options = {})
|
32
|
+
if h.cms_edit_mode?
|
33
|
+
{ 'data-cms-sortable' => { url: h.main_app.edit_viewable_url(format: :js) }.to_json }.merge(options)
|
34
|
+
else
|
35
|
+
options
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def sortable_html(options = {})
|
40
|
+
sortable(options).to_a.map{ |a| %{#{a.first}=#{a.last}} }.join(' ')
|
41
|
+
end
|
42
|
+
|
43
|
+
def ul_sortable_tag(options = {})
|
44
|
+
h.content_tag :ul, sortable(options) do
|
45
|
+
yield
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def add_path
|
52
|
+
h.main_app.new_viewable_url list_key: @list_key, max: @max
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class ViewablePresenter < BasePresenter
|
2
|
+
def edit_link(name = nil)
|
3
|
+
return unless h.cms_edit_mode?
|
4
|
+
|
5
|
+
h.link_to edit_path, class: "cms-edit cms-edit-#{m.dashed_name}", 'data-no-turbolink' => true do
|
6
|
+
h.concat h.content_tag(:span, h.t('cms.edit'), class: "cms-edit-action")
|
7
|
+
h.concat " "
|
8
|
+
h.concat h.content_tag(:span, name, class: "cms-edit-name")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def li_sortable_tag(options = nil)
|
13
|
+
options ||= {}
|
14
|
+
if h.cms_edit_mode?
|
15
|
+
options['data-cms-sortable-id'] = m.unique_key.id
|
16
|
+
end
|
17
|
+
h.content_tag :li, options do
|
18
|
+
yield
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def edit_path
|
25
|
+
h.rails_admin.edit_path(model_name: m.class.name.underscore.gsub('/', '~'), id: m.id)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'cms/shared/flash_messages' %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
%ul.nav.navbar-nav.navbar-right.root_links
|
2
|
+
- actions(:root).each do |action|
|
3
|
+
%li{class: "#{action.action_name}_root_link"}= link_to wording_for(:menu, action), { action: action.action_name, controller: 'rails_admin/main' }, class: "pjax"
|
4
|
+
= admin_locale_selector
|
5
|
+
= admin_back_home
|
6
|
+
- if _current_user
|
7
|
+
- if user_link = edit_user_link
|
8
|
+
%li.edit_user_root_link= user_link
|
9
|
+
- if logout_path.present?
|
10
|
+
%li= link_to content_tag('span', t('admin.misc.log_out'), class: 'label label-danger'), logout_path, method: logout_method
|
@@ -0,0 +1,32 @@
|
|
1
|
+
en:
|
2
|
+
cms:
|
3
|
+
show_mode: Show
|
4
|
+
edit_mode: Edit
|
5
|
+
edit: Edit
|
6
|
+
add: Add
|
7
|
+
add_page: New Page
|
8
|
+
form:
|
9
|
+
submit:
|
10
|
+
send: Send
|
11
|
+
sending: Sending...
|
12
|
+
email:
|
13
|
+
default_subject: Subject
|
14
|
+
default_body: Body
|
15
|
+
navigation: Site
|
16
|
+
one: Form
|
17
|
+
other: Forms
|
18
|
+
locale_selector:
|
19
|
+
language: En
|
20
|
+
page:
|
21
|
+
navigation: Site
|
22
|
+
one: Page
|
23
|
+
other: Pages
|
24
|
+
setting:
|
25
|
+
navigation: Site
|
26
|
+
one: Setting
|
27
|
+
other: Settings
|
28
|
+
rich:
|
29
|
+
file:
|
30
|
+
navigation: Site
|
31
|
+
one: File
|
32
|
+
other: Files
|
@@ -0,0 +1,32 @@
|
|
1
|
+
fr:
|
2
|
+
cms:
|
3
|
+
show_mode: Voir
|
4
|
+
edit_mode: Éditer
|
5
|
+
edit: Modifier
|
6
|
+
add: Ajouter
|
7
|
+
add_page: Nouvelle Page
|
8
|
+
form:
|
9
|
+
submit:
|
10
|
+
send: Envoyer
|
11
|
+
sending: En cours...
|
12
|
+
email:
|
13
|
+
default_subject: Sujet
|
14
|
+
default_body: Texte
|
15
|
+
navigation: Site
|
16
|
+
one: Formulaire
|
17
|
+
other: Formulaires
|
18
|
+
locale_selector:
|
19
|
+
language: Fr
|
20
|
+
page:
|
21
|
+
navigation: Site
|
22
|
+
one: Page
|
23
|
+
other: Pages
|
24
|
+
setting:
|
25
|
+
navigation: Site
|
26
|
+
one: Paramètre
|
27
|
+
other: Paramètres
|
28
|
+
rich:
|
29
|
+
file:
|
30
|
+
navigation: Site
|
31
|
+
one: Fichier
|
32
|
+
other: Fichiers
|
@@ -0,0 +1,43 @@
|
|
1
|
+
en:
|
2
|
+
flash_messages:
|
3
|
+
#
|
4
|
+
# These are the translations for the different headings.
|
5
|
+
#
|
6
|
+
headings:
|
7
|
+
success: "Success!"
|
8
|
+
info: "Info!"
|
9
|
+
warning: "Warning!"
|
10
|
+
error: "Error!"
|
11
|
+
#
|
12
|
+
# Add default flash messages:
|
13
|
+
defaults:
|
14
|
+
success: "Your request processed successfully"
|
15
|
+
error: "Something went wrong"
|
16
|
+
# create:
|
17
|
+
# success: "Successfully created!"
|
18
|
+
# error: "Something went wrong. Please take a look at the form to see what went wrong."
|
19
|
+
#
|
20
|
+
# Add flash messages for controller actions:
|
21
|
+
# products:
|
22
|
+
# create:
|
23
|
+
# success: "This is a notification"
|
24
|
+
# error: "Something went wrong"
|
25
|
+
#
|
26
|
+
# Inside controller:
|
27
|
+
# def create
|
28
|
+
# flash!(:success, :error)
|
29
|
+
# redirect_to(:root)
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
# OR
|
33
|
+
#
|
34
|
+
# def create
|
35
|
+
# redirect_to(:root, :flash => [:success, :error])
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# OR
|
39
|
+
#
|
40
|
+
# def create
|
41
|
+
# flash_now!(:success, :error)
|
42
|
+
# render("new")
|
43
|
+
# end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
fr:
|
2
|
+
flash_messages:
|
3
|
+
#
|
4
|
+
# These are the translations for the different headings.
|
5
|
+
#
|
6
|
+
headings:
|
7
|
+
success: "Success!"
|
8
|
+
info: "Info!"
|
9
|
+
warning: "Warning!"
|
10
|
+
error: "Error!"
|
11
|
+
#
|
12
|
+
# Add default flash messages:
|
13
|
+
defaults:
|
14
|
+
success: "Votre requête a bien été reçue"
|
15
|
+
error: "Une erreur s'est produite"
|
16
|
+
# create:
|
17
|
+
# success: "Successfully created!"
|
18
|
+
# error: "Something went wrong. Please take a look at the form to see what went wrong."
|
19
|
+
#
|
20
|
+
# Add flash messages for controller actions:
|
21
|
+
# products:
|
22
|
+
# create:
|
23
|
+
# success: "This is a notification"
|
24
|
+
# error: "Something went wrong"
|
25
|
+
#
|
26
|
+
# Inside controller:
|
27
|
+
# def create
|
28
|
+
# flash!(:success, :error)
|
29
|
+
# redirect_to(:root)
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
# OR
|
33
|
+
#
|
34
|
+
# def create
|
35
|
+
# redirect_to(:root, :flash => [:success, :error])
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# OR
|
39
|
+
#
|
40
|
+
# def create
|
41
|
+
# flash_now!(:success, :error)
|
42
|
+
# render("new")
|
43
|
+
# end
|