From 533a4ee4aaa347e5b81c37a7352254de701d0596 Mon Sep 17 00:00:00 2001 From: dinedine Date: Tue, 13 Jul 2010 22:01:40 +0200 Subject: [PATCH] flash messages in French + new icon for assets + ajax update for almost all forms --- app/controllers/admin/assets_controller.rb | 2 + app/controllers/admin/contents_controller.rb | 2 + .../admin/current_sites_controller.rb | 2 + app/controllers/admin/layouts_controller.rb | 2 + .../admin/my_accounts_controller.rb | 2 + app/controllers/admin/pages_controller.rb | 28 +---- app/controllers/admin/snippets_controller.rb | 2 + .../admin/theme_assets_controller.rb | 2 +- app/helpers/admin/base_helper.rb | 2 +- .../admin/asset_collections/edit.html.haml | 4 +- app/views/admin/assets/edit.html.haml | 4 +- app/views/admin/content_types/edit.html.haml | 2 +- app/views/admin/contents/edit.html.haml | 2 +- app/views/admin/contents/index.html.haml | 2 +- app/views/admin/current_sites/edit.html.haml | 4 +- app/views/admin/layouts/edit.html.haml | 4 +- app/views/admin/layouts/index.html.haml | 2 +- app/views/admin/my_accounts/edit.html.haml | 4 +- app/views/admin/pages/index.html.haml | 2 +- app/views/admin/snippets/edit.html.haml | 4 +- app/views/admin/snippets/index.html.haml | 2 +- app/views/admin/theme_assets/edit.html.haml | 4 +- app/views/admin/theme_assets/index.html.haml | 2 +- app/views/layouts/admin/application.html.haml | 1 + config/locales/admin_ui_fr.yml | 64 ---------- config/locales/flash.en.yml | 4 +- config/locales/flash.fr.yml | 116 ++++++++++++++++++ doc/TODO | 11 +- lib/locomotive/admin_responder.rb | 2 +- public/images/admin/icons/actions.png | Bin 0 -> 704 bytes public/images/admin/menu/icons/assets.png | Bin 0 -> 1115 bytes public/javascripts/admin/plugins/shortcut.js | 23 +--- public/stylesheets/admin/buttons.css | 21 ++-- public/stylesheets/admin/layout.css | 32 +++-- public/stylesheets/admin/menu.css | 6 +- spec/models/membership_spec.rb | 9 +- 36 files changed, 202 insertions(+), 173 deletions(-) create mode 100644 config/locales/flash.fr.yml create mode 100644 public/images/admin/icons/actions.png create mode 100644 public/images/admin/menu/icons/assets.png diff --git a/app/controllers/admin/assets_controller.rb b/app/controllers/admin/assets_controller.rb index d324260a..1c8c6a69 100644 --- a/app/controllers/admin/assets_controller.rb +++ b/app/controllers/admin/assets_controller.rb @@ -5,6 +5,8 @@ module Admin before_filter :set_collections_and_current_collection + respond_to :json, :only => :update + def create create! { edit_admin_asset_collection_url(@asset_collection) } end diff --git a/app/controllers/admin/contents_controller.rb b/app/controllers/admin/contents_controller.rb index 59ad79d5..3759a27f 100644 --- a/app/controllers/admin/contents_controller.rb +++ b/app/controllers/admin/contents_controller.rb @@ -4,6 +4,8 @@ module Admin sections 'contents' before_filter :set_content_type + + respond_to :json, :only => :update def index @contents = @content_type.list_or_group_contents diff --git a/app/controllers/admin/current_sites_controller.rb b/app/controllers/admin/current_sites_controller.rb index 21add878..5ad2d3c3 100644 --- a/app/controllers/admin/current_sites_controller.rb +++ b/app/controllers/admin/current_sites_controller.rb @@ -5,6 +5,8 @@ module Admin actions :edit, :update + respond_to :json, :only => :update + def update update! do |success, failure| success.html { redirect_to edit_admin_current_site_url(new_host_if_subdomain_changed) } diff --git a/app/controllers/admin/layouts_controller.rb b/app/controllers/admin/layouts_controller.rb index c4889544..868b0dd0 100644 --- a/app/controllers/admin/layouts_controller.rb +++ b/app/controllers/admin/layouts_controller.rb @@ -3,6 +3,8 @@ module Admin sections 'settings' + respond_to :json, :only => :update + def index @layouts = current_site.layouts.order_by([[:name, :asc]]) end diff --git a/app/controllers/admin/my_accounts_controller.rb b/app/controllers/admin/my_accounts_controller.rb index 244a4ae7..1eb9e567 100644 --- a/app/controllers/admin/my_accounts_controller.rb +++ b/app/controllers/admin/my_accounts_controller.rb @@ -5,6 +5,8 @@ module Admin actions :edit, :update + respond_to :json, :only => :update + def update update! { edit_admin_my_account_url } end diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index 5464dbc4..b8304860 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -28,30 +28,4 @@ module Admin end end -end - -# DEPRECATED - -# def edit -# @page = current_site.pages.find(params[:id]) -# end -# -# def create -# @page = current_site.pages.create(params[:page]) -# -# respond_with(@page, :location => (edit_admin_page_url(@page) rescue nil)) -# end -# -# def update -# @page = current_site.pages.find(params[:id]) -# @page.update_attributes(params[:page]) -# -# respond_with(@page, :location => edit_admin_page_url(@page)) -# end -# -# def destroy -# @page = current_site.pages.find(params[:id]) -# @page.destroy -# -# respond_with(@page, :alert => @page.errors.full_messages.first, :location => admin_pages_url) -# end \ No newline at end of file +end \ No newline at end of file diff --git a/app/controllers/admin/snippets_controller.rb b/app/controllers/admin/snippets_controller.rb index 410f2287..7f4dad16 100644 --- a/app/controllers/admin/snippets_controller.rb +++ b/app/controllers/admin/snippets_controller.rb @@ -2,6 +2,8 @@ module Admin class SnippetsController < BaseController sections 'settings' + + respond_to :json, :only => :update def index @snippets = current_site.snippets.order_by([[:name, :asc]]) diff --git a/app/controllers/admin/theme_assets_controller.rb b/app/controllers/admin/theme_assets_controller.rb index 55749de8..3590ed92 100644 --- a/app/controllers/admin/theme_assets_controller.rb +++ b/app/controllers/admin/theme_assets_controller.rb @@ -5,7 +5,7 @@ module Admin sections 'settings', 'theme_assets' - respond_to :json, :only => :create + respond_to :json, :only => [:create, :update] def index assets = current_site.theme_assets.all diff --git a/app/helpers/admin/base_helper.rb b/app/helpers/admin/base_helper.rb index 52f0ece7..36c774d7 100644 --- a/app/helpers/admin/base_helper.rb +++ b/app/helpers/admin/base_helper.rb @@ -17,7 +17,7 @@ module Admin::BaseHelper def admin_button_tag(text, url, options = {}) text = text.is_a?(Symbol) ? t(".#{text}") : text link_to(url, options) do - content_tag(:span, text) + content_tag(:em, escape_once(' ')) + text end end diff --git a/app/views/admin/asset_collections/edit.html.haml b/app/views/admin/asset_collections/edit.html.haml index 86a432e3..ca9a8e7e 100644 --- a/app/views/admin/asset_collections/edit.html.haml +++ b/app/views/admin/asset_collections/edit.html.haml @@ -10,7 +10,7 @@ %p= t('.help') - content_for :buttons do - = admin_button_tag :add_asset, new_admin_asset_url(@asset_collection), :class => 'add' + = admin_button_tag :add_asset, new_admin_asset_url(@asset_collection), :class => 'new' %p.no-items{ :style => "#{'display: none' unless @asset_collection.assets.empty? }" } = t('.no_items', :url => new_admin_asset_url(@asset_collection)) @@ -28,6 +28,6 @@ = render 'admin/custom_fields/index', :form => f, :collection_name => 'assets' - = render 'admin/shared/form_actions', :delete_button => link_to(content_tag(:span, t('.destroy')), admin_asset_collection_url(@asset_collection), :confirm => t('admin.messages.confirm'), :method => :delete, :class => 'button small remove'), :button_label => :update + = render 'admin/shared/form_actions', :delete_button => link_to(content_tag(:em, escape_once(' ')) + t('.destroy'), admin_asset_collection_url(@asset_collection), :confirm => t('admin.messages.confirm'), :method => :delete, :class => 'button small remove'), :button_label => :update = render 'admin/custom_fields/edit_field' \ No newline at end of file diff --git a/app/views/admin/assets/edit.html.haml b/app/views/admin/assets/edit.html.haml index f841fe91..c965558d 100644 --- a/app/views/admin/assets/edit.html.haml +++ b/app/views/admin/assets/edit.html.haml @@ -4,11 +4,11 @@ = render 'admin/shared/menu/assets' - content_for :buttons do - = admin_button_tag t('admin.asset_collections.edit.add_asset'), new_admin_asset_url(@asset_collection), :class => 'add' + = admin_button_tag t('admin.asset_collections.edit.add_asset'), new_admin_asset_url(@asset_collection), :class => 'new' %p= t('.help') -= semantic_form_for @asset, :url => admin_asset_url(@asset_collection, @asset), :html => { :multipart => true } do |form| += semantic_form_for @asset, :url => admin_asset_url(@asset_collection, @asset), :html => { :multipart => true, :class => 'save-with-shortcut' } do |form| = render 'form', :f => form diff --git a/app/views/admin/content_types/edit.html.haml b/app/views/admin/content_types/edit.html.haml index 77fd7188..f18680f6 100644 --- a/app/views/admin/content_types/edit.html.haml +++ b/app/views/admin/content_types/edit.html.haml @@ -5,7 +5,7 @@ - content_for :buttons do = admin_button_tag :show_items, admin_contents_url(@content_type.slug), :class => 'show' - = admin_button_tag :new_item, new_admin_content_url(@content_type.slug), :class => 'show' + = admin_button_tag :new_item, new_admin_content_url(@content_type.slug), :class => 'new' %p= t('.help') diff --git a/app/views/admin/contents/edit.html.haml b/app/views/admin/contents/edit.html.haml index 3b353ad8..a46e1099 100644 --- a/app/views/admin/contents/edit.html.haml +++ b/app/views/admin/contents/edit.html.haml @@ -9,7 +9,7 @@ %p= @content_type.description -= semantic_form_for @content, :as => :content, :url => admin_content_url(@content_type.slug, @content), :html => { :multipart => true } do |form| += semantic_form_for @content, :as => :content, :url => admin_content_url(@content_type.slug, @content), :html => { :multipart => true, :class => 'save-with-shortcut' } do |form| = render 'form', :f => form diff --git a/app/views/admin/contents/index.html.haml b/app/views/admin/contents/index.html.haml index 1cb5c386..721ffa6d 100644 --- a/app/views/admin/contents/index.html.haml +++ b/app/views/admin/contents/index.html.haml @@ -24,4 +24,4 @@ = form_tag sort_admin_contents_path(@content_type.slug), :method => :put, :class => 'formtastic' do = hidden_field_tag :order - = render 'admin/shared/form_actions', :delete_button => link_to(content_tag(:span, t('.destroy')), admin_content_type_url(@content_type), :confirm => t('admin.messages.confirm'), :method => :delete, :class => 'button small remove'), :button_label => :update \ No newline at end of file + = render 'admin/shared/form_actions', :delete_button => link_to(content_tag(:em, escape_once(' ')) + t('.destroy'), admin_content_type_url(@content_type), :confirm => t('admin.messages.confirm'), :method => :delete, :class => 'button small remove'), :button_label => :update \ No newline at end of file diff --git a/app/views/admin/current_sites/edit.html.haml b/app/views/admin/current_sites/edit.html.haml index d8e8ea28..9565af26 100644 --- a/app/views/admin/current_sites/edit.html.haml +++ b/app/views/admin/current_sites/edit.html.haml @@ -4,11 +4,11 @@ = render 'admin/shared/menu/settings' - content_for :buttons do - = admin_button_tag t('.new_membership'), new_admin_membership_url, :class => 'add' + = admin_button_tag t('.new_membership'), new_admin_membership_url, :class => 'new' %p= t('.help') -= semantic_form_for @site, :url => admin_current_site_url do |f| += semantic_form_for @site, :url => admin_current_site_url, :html => { :class => 'save-with-shortcut' } do |f| = render 'form', :f => f diff --git a/app/views/admin/layouts/edit.html.haml b/app/views/admin/layouts/edit.html.haml index dfc5eaf3..33cb4213 100644 --- a/app/views/admin/layouts/edit.html.haml +++ b/app/views/admin/layouts/edit.html.haml @@ -7,11 +7,11 @@ = render 'admin/shared/menu/settings' - content_for :buttons do - = admin_button_tag :new, new_admin_layout_url, :class => 'add' + = admin_button_tag :new, new_admin_layout_url, :class => 'new' %p= t('.help') -= semantic_form_for @layout, :url => admin_layout_url(@layout) do |form| += semantic_form_for @layout, :url => admin_layout_url(@layout), :html => { :class => 'save-with-shortcut' } do |form| = render 'form', :f => form diff --git a/app/views/admin/layouts/index.html.haml b/app/views/admin/layouts/index.html.haml index bfc618f7..86bc769e 100644 --- a/app/views/admin/layouts/index.html.haml +++ b/app/views/admin/layouts/index.html.haml @@ -4,7 +4,7 @@ = render 'admin/shared/menu/settings' - content_for :buttons do - = admin_button_tag :new, new_admin_layout_url, :class => 'add' + = admin_button_tag :new, new_admin_layout_url, :class => 'new' %p= t('.help') diff --git a/app/views/admin/my_accounts/edit.html.haml b/app/views/admin/my_accounts/edit.html.haml index 6da83873..297e121c 100644 --- a/app/views/admin/my_accounts/edit.html.haml +++ b/app/views/admin/my_accounts/edit.html.haml @@ -4,11 +4,11 @@ = render 'admin/shared/menu/settings' - content_for :buttons do - = admin_button_tag t('.new_site'), new_admin_site_url, :class => 'add' + = admin_button_tag t('.new_site'), new_admin_site_url, :class => 'new' %p= t('.help') -= semantic_form_for @account, :as => :my_account, :url => admin_my_account_url do |f| += semantic_form_for @account, :as => :my_account, :url => admin_my_account_url, :html => { :class => 'save-with-shortcut' } do |f| = f.foldable_inputs :name => :information, :style => 'display: none' do = f.input :name diff --git a/app/views/admin/pages/index.html.haml b/app/views/admin/pages/index.html.haml index a8f14f1f..3f4d8bb6 100644 --- a/app/views/admin/pages/index.html.haml +++ b/app/views/admin/pages/index.html.haml @@ -7,7 +7,7 @@ = render 'admin/shared/menu/contents' - content_for :buttons do - = admin_button_tag :new, new_admin_page_url, :class => 'add' + = admin_button_tag :new, new_admin_page_url, :class => 'new' %p= t('.help') diff --git a/app/views/admin/snippets/edit.html.haml b/app/views/admin/snippets/edit.html.haml index 69dce122..34145635 100644 --- a/app/views/admin/snippets/edit.html.haml +++ b/app/views/admin/snippets/edit.html.haml @@ -4,11 +4,11 @@ = render 'admin/shared/menu/settings' - content_for :buttons do - = admin_button_tag t('admin.snippets.index.new'), new_admin_snippet_url, :class => 'add' + = admin_button_tag t('admin.snippets.index.new'), new_admin_snippet_url, :class => 'new' %p= t('.help') -= semantic_form_for @snippet, :url => admin_snippet_url(@snippet) do |form| += semantic_form_for @snippet, :url => admin_snippet_url(@snippet), :html => { :class => 'save-with-shortcut' } do |form| = render 'form', :f => form diff --git a/app/views/admin/snippets/index.html.haml b/app/views/admin/snippets/index.html.haml index c56aa4d5..f3933602 100644 --- a/app/views/admin/snippets/index.html.haml +++ b/app/views/admin/snippets/index.html.haml @@ -4,7 +4,7 @@ = render 'admin/shared/menu/settings' - content_for :buttons do - = admin_button_tag :new, new_admin_snippet_url, :class => 'add' + = admin_button_tag :new, new_admin_snippet_url, :class => 'new' %p= t('.help') diff --git a/app/views/admin/theme_assets/edit.html.haml b/app/views/admin/theme_assets/edit.html.haml index 56eb1311..49b83598 100644 --- a/app/views/admin/theme_assets/edit.html.haml +++ b/app/views/admin/theme_assets/edit.html.haml @@ -4,11 +4,11 @@ = render 'admin/shared/menu/settings' - content_for :buttons do - = admin_button_tag t('admin.theme_assets.index.new'), new_admin_theme_asset_url, :class => 'add' + = admin_button_tag t('admin.theme_assets.index.new'), new_admin_theme_asset_url, :class => 'new' %p= t('.help', :url => @theme_asset.source.url) -= semantic_form_for @theme_asset, :url => admin_theme_asset_url(@theme_asset), :html => { :multipart => true } do |form| += semantic_form_for @theme_asset, :url => admin_theme_asset_url(@theme_asset), :html => { :multipart => true, :class => 'save-with-shortcut' } do |form| = render 'form', :f => form diff --git a/app/views/admin/theme_assets/index.html.haml b/app/views/admin/theme_assets/index.html.haml index 32765915..1c79e74b 100644 --- a/app/views/admin/theme_assets/index.html.haml +++ b/app/views/admin/theme_assets/index.html.haml @@ -4,7 +4,7 @@ = render 'admin/shared/menu/settings' - content_for :buttons do - = admin_button_tag :new, new_admin_theme_asset_url, :class => 'add' + = admin_button_tag :new, new_admin_theme_asset_url, :class => 'new' %p= t('.help') diff --git a/app/views/layouts/admin/application.html.haml b/app/views/layouts/admin/application.html.haml index 3a90bbe1..e11440b8 100644 --- a/app/views/layouts/admin/application.html.haml +++ b/app/views/layouts/admin/application.html.haml @@ -18,6 +18,7 @@ %h2= title #local-actions-bar +   = yield :buttons = yield diff --git a/config/locales/admin_ui_fr.yml b/config/locales/admin_ui_fr.yml index 76157403..a3cf735a 100644 --- a/config/locales/admin_ui_fr.yml +++ b/config/locales/admin_ui_fr.yml @@ -110,13 +110,6 @@ fr: show: voir help: "Le titre de la page est modifiable en cliquant dessus." ask_for_title: "Veuillez entrer le nouveau titre" - messages: - successful_create: "La page a été créée avec succès." - successful_update: "La page a été mise à jour avec succès." - successful_destroy: "La page a été supprimée avec succès." - successful_sort: "Les pages ont été ordonnées avec succès." - failed_create: "La page n'a pas été créée." - failed_update: "La page n'a pas été mise à jour." form: cache_strategy: none: Aucun @@ -141,12 +134,6 @@ fr: new: nouveau gabarit layout: updated_at: Mis à jour le - messages: - successful_create: "Le gabarit a été crée avec succès." - successful_update: "Le gabarit a été mis à jour avec succès." - successful_destroy: "Le gabarit a été supprimé avec succès." - failed_create: "Le gabarit n'a pas été crée." - failed_update: "Le gabarit n'a pas été mis à jour." snippets: index: @@ -162,45 +149,27 @@ fr: help: "Remplissez le formulaire ci-dessous pour mettre à jour votre snippet." snippet: updated_at: Mis à jour le - messages: - successful_create: "Le snippet a été crée avec succès." - successful_update: "Le snippet a été mis à jour avec succès." - successful_destroy: "Le snippet a été supprimé avec succès." - failed_create: "Le snippet n'a pas été crée." - failed_update: "Le snippet n'a pas été mis à jour." sites: new: title: "Nouveau site" help: "Remplissez le formulaire ci-dessous pour créer votre nouveau site." - messages: - successful_create: "Le site a été crée avec succès." - failed_create: "Le site n'a pas été crée." current_sites: edit: new_membership: ajouter compte help: "Le nom du site est modifiable en cliquant dessus." ask_for_name: "Veuillez entrer le nouveau nom" - messages: - successful_update: "Le site a été mis à jour avec succès." - failed_update: "Le site n'a pas été mis à jour." memberships: new: title: "Ajout d'un compte" help: "Donnez l'adresse email du compte à ajouter. S'il n'existe pas, vous serez redirigé(e) vers le formulaire de création d'un compte." - messages: - successful_create: "Le compte a été ajouté avec succès." - failed_create: "Le compte n'a pas été ajouté." accounts: new: title: Nouveau compte help: "Remplissez le formulaire ci-dessous pour ajouter un nouveau compte." - messages: - successful_create: "Le compte a été crée avec succès." - failed_create: "Le compte n'a pas été crée." my_accounts: edit: @@ -209,9 +178,6 @@ fr: en: en Anglais fr: en Français ask_for_name: "Veuillez entrer le nouveau nom" - messages: - successful_update: "Mon compte a été mis à jour avec succès." - failed_update: "compte site n'a pas été mis à jour." theme_assets: index: @@ -234,12 +200,6 @@ fr: images: title: Liste des images no_items: "Il n'y a pas d'images." - messages: - successful_create: "Le fichier a été crée avec succès." - successful_update: "Le fichier a été mis à jour avec succès." - successful_destroy: "Le fichier a été supprimé avec succès." - failed_create: "Le fichier n'a pas été crée." - failed_update: "Le fichier n'a pas été mis à jour." asset_collections: index: @@ -256,12 +216,6 @@ fr: destroy: supprimer collection no_items: "Il n'existe pas de médias. Vous pouvez commencer par créer un ici." ask_for_name: "Veuillez entrer le nouveau nom" - messages: - successful_create: "La collection a été créée avec succès." - successful_update: "La collection a été mise à jour avec succès." - successful_destroy: "La collection a été supprimée avec succès." - failed_create: "La collection n'a pas été créée." - failed_update: "La collection n'a pas été mise à jour." assets: new: @@ -270,12 +224,6 @@ fr: edit: title: "Edition média" help: "Remplissez le formulaire ci-dessous pour mettre à jour votre média." - messages: - successful_create: "Le média a été crée avec succès." - successful_update: "Le média a été mis à jour avec succès." - successful_destroy: "Le média a été supprimé avec succès." - failed_create: "Le média n'a pas été crée." - failed_update: "Le média n'a pas été mis à jour." content_types: index: @@ -292,12 +240,6 @@ fr: order_by: updated_at: 'Par date de mise à jour' position_in_list: Manuellement - messages: - successful_create: "Le modèle a été crée avec succès." - successful_update: "Le modèle a été mis à jour avec succès." - successful_destroy: "Le modèle a été supprimé avec succès." - failed_create: "Le modèle n'a pas été crée." - failed_update: "Le modèle n'a pas été mis à jour." contents: index: @@ -315,12 +257,6 @@ fr: title: '{{type}} — nouvel élément' edit: title: '{{type}} — édition élément' - messages: - successful_create: "L'élément a été crée avec succès." - successful_update: "L'élément a été mis à jour avec succès." - successful_destroy: "L'élément a été supprimé avec succès." - failed_create: "L'élément a été crée avec succès." - failed_update: "L'élément a été supprimé avec succès." formtastic: titles: diff --git a/config/locales/flash.en.yml b/config/locales/flash.en.yml index fe0a6616..8f35d681 100644 --- a/config/locales/flash.en.yml +++ b/config/locales/flash.en.yml @@ -3,10 +3,10 @@ en: admin: pages: create: - notice: "Page was successfully created" + notice: "Page was successfully created." alert: "Page was not created." update: - notice: "Page was successfully updated" + notice: "Page was successfully updated." alert: "Page was not updated." sort: notice: "Pages were successfully sorted." diff --git a/config/locales/flash.fr.yml b/config/locales/flash.fr.yml new file mode 100644 index 00000000..b5c2e8b7 --- /dev/null +++ b/config/locales/flash.fr.yml @@ -0,0 +1,116 @@ +fr: + flash: + admin: + pages: + create: + notice: "La page a été créée avec succès." + alert: "La page n'a pas été créée." + update: + notice: "La page a été mise à jour avec succès." + alert: "La page n'a pas été mise à jour." + sort: + notice: "Les pages ont été ordonnées avec succès." + destroy: + notice: "La page a été supprimée avec succès." + + contents: + create: + notice: "L'élément a été crée avec succès." + alert: "L'élément a été crée avec succès." + update: + notice: "L'élément a été mis à jour avec succès." + alert: "L'élément n'a pas été mis à jour." + sort: + notice: "Les éléments ont été ordonnés avec succès." + destroy: + notice: "L'élément a été supprimé avec succès." + + content_types: + create: + notice: "Le modèle a été crée avec succès." + alert: "Le modèle n'a pas été crée." + update: + notice: "Le modèle a été mis à jour avec succès." + alert: "Le modèle n'a pas été mis à jour." + destroy: + notice: "Le modèle a été supprimé avec succès." + + current_sites: + update: + notice: "Mon site a été mis à jour avec succès." + alert: "Mon site n'a pas été mis à jour." + + layouts: + create: + notice: "Le gabarit a été crée avec succès." + alert: "Le gabarit n'a pas été crée." + update: + notice: "Le gabarit a été mis à jour avec succès." + alert: "Le gabarit n'a pas été mis à jour." + destroy: + notice: "Le gabarit a été supprimé avec succès." + + snippets: + create: + notice: "Le snippet a été crée avec succès." + alert: "Le snippet n'a pas été crée." + update: + notice: "Le snippet a été mis à jour avec succès." + alert: "Le snippet n'a pas été mis à jour." + destroy: + notice: "Le snippet a été supprimé avec succès." + + accounts: + create: + notice: "Le compte a été crée avec succès." + alert: "Le compte n'a pas été crée." + + my_accounts: + update: + notice: "Mon compte a été mis à jour avec succès." + alert: "Mon compte n'a pas été mis à jour." + + sites: + create: + notice: "Le site a été crée avec succès." + alert: "Le site n'a pas été crée." + destroy: + notice: "Le site a été supprimé avec succès." + + memberships: + create: + notice: "Le compte a été ajouté avec succès." + alert: "Le compte n'a pas été ajouté." + already_created: "Le compte a déjà été ajouté pour ce site." + + asset_collections: + create: + notice: "La collection a été créée avec succès." + alert: "La collection n'a pas été créée." + update: + notice: "La collection a été mise à jour avec succès." + alert: "La collection n'a pas été mise à jour." + destroy: + notice: "La collection a été supprimée avec succès." + + assets: + create: + notice: "Le média a été crée avec succès." + alert: "Le média n'a pas été crée." + update: + notice: "Le média a été mis à jour avec succès." + alert: "Le média n'a pas été mis à jour." + + theme_assets: + create: + notice: "Le fichier a été crée avec succès." + alert: "Le fichier n'a pas été crée." + update: + notice: "Le fichier a été mis à jour avec succès." + alert: "Le fichier n'a pas été mis à jour." + destroy: + notice: "Le fichier a été supprimé avec succès." + + custom_fields: + update: + alert: "Champ non mis à jour." diff --git a/doc/TODO b/doc/TODO index c8353a67..e13965f8 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,12 +1,7 @@ BOARD: - refactor slugify method (use parameterize + create a module) - -- save layout / snippet / page / stylesheet / javascript with CMD + S (ajax) -- change action icons according to the right action [Sacha] -- page redirection (option) - send email when new content added thru api -- flash messages in French BACKLOG: @@ -30,6 +25,7 @@ NICE TO HAVE: - theme asset picker when editing layout - asset picker (content instance) - page with regexp url ? +- page redirection (option) DONE: @@ -59,4 +55,7 @@ x textile filter x [bug] varnish can not be refreshed in heroku so "max-age" has to be disabled => modify cache strategy x "remember me" should always be enabled x sitemap -x refactoring admin crud (pages + layouts + snippets) \ No newline at end of file +x refactoring admin crud (pages + layouts + snippets) +x flash messages in French +x save layout / snippet / page / stylesheet / javascript with CMD + S (ajax) +x change action icons according to the right action [Sacha] \ No newline at end of file diff --git a/lib/locomotive/admin_responder.rb b/lib/locomotive/admin_responder.rb index 2da28cb8..f0228124 100644 --- a/lib/locomotive/admin_responder.rb +++ b/lib/locomotive/admin_responder.rb @@ -12,7 +12,7 @@ module Locomotive if get? display resource elsif has_errors? - display({ :errors => resource.errors, :alert => flash[:alert] }, :status => :unprocessable_entity) + display({ :errors => resource.errors, :model => controller.send(:resource_instance_name), :alert => controller.flash[:alert] }) elsif post? display resource, :status => :created, :location => resource_location else diff --git a/public/images/admin/icons/actions.png b/public/images/admin/icons/actions.png new file mode 100644 index 0000000000000000000000000000000000000000..38a7d90501e618ff09cfd321d26c5832173bf814 GIT binary patch literal 704 zcmV;x0zdtUP)}W=^zS0_8>Fgbn6b|Bc|y zmhgwZbg*wP- z_yP-X)#X4U=s$75YTwa~YM)wWA;nlb`Uu_`V=0->*qTii#A!tREsmz(1;z(iX*B9U z!o3S^`b^-fZylUgf=-cg;ox68peDi)@tTvj4ltBv@(nIQ14VRLXarLKO;E4i4f_aK zeE{{|_4vAefjlF?SXO=OdOViPI4c5-YfwKSY|L50xWhLK7+0#+W*SRxyl*^OtiJE-fYtA)6L*Z}(T#D+wvcYZZP2Sd!+5!nN|a8#j{c}RPr|m8%R*HVX<>su zR(^G&rNO>xh((WV9h58mC|{oaqy&0mIW-`6-vf_1>zvQiyl24eoK#o1mq=^OD^UDgyaGvuJ-Q547Do6(6Ja~XBC zro~7xB-^1ZTZk;dAS$V_g%+$YMi3eGp&$tQP?qMmih@2wVc4b>Z3KeaVwx>lmZc_P zSvJ;eHS?zbvGd~fd^5eN4*a?}EQa%OAmo1Dz)lP_TG2q*}lNHpufPGAcU3%i+~o?4bYKdTkvKF|q1c)i~8 z-d_7A^sV5vQbVLefsh6Lt)LK4-w_)dT@@7-+3E3obM)E2d~&+nF2#E`uqQDwzO1{u z=LtW%hJ)%54-_9IZ}tFRM8x0vDx;O%NG^cY)SUw z!^f8-Cl4N)+qm|{M?nK=P%lxUc7Xpl27srf&C5# zetArg6Mo@mhRAVP-u=EOiw~sVTyA$18WT=>1loxThxQtc#*NC4YX$asx7#zR?R960 zJb?{v95Tebc=qgRyD$vru%h`*@MzcJ(i0DY1$Hf^QPbm=Y~|$Uf_%!?Sm5DDlqDuf zk`mD-*3{PLVXw~(5X3(E@b!v!@7~X)*i;4kDl`=EwAZ=HxvsA6nP{#C%9JXH!?_+I zB&rHRF?j{PtCxptnLuF|s5o4sv!I}cqImsgbvzvwiwW{RD($PoISEaSriZ+2az9@b z4Tc5tXZ3*57*7SkGAA}zwK+?IkD8tpJ#2Wg0h{mBnJh_x1aFv3;it^z2#bWsm;92X zQ?NZD-tzHRwb6*plprsUW^QZDbqOS>lT1+I|7mT3ey2w$7gV!Q3l$RXXM`eX1nWQ( zzgz?I6!Y|feR>2VK_Pg{LX{v(zxuxrK3up}CN~!$S ziG#Zx+)+KZ@E!`mDmE3#Jk?w@SDFOX^S%6MK-<`5TA~+NR7=hVX^N$#01t=NU9BZ6 zuYeCAM_nvb;}Z7T#-wv-4Jcn!rp|*E8jC0lbOpfXs0GzI>twPN1;N8n;L(V^Gg_zo z+Z6x?^Eg3u1(-CvpBL;8r;kNtqdgtYw_qTwfBM7Oe+7W!oX^5PUjg8#5W3ZKa%f%w h|6~T?Kidxh1_1EHQ9W9_0T=)P002ovPDHLkV1kSG6=DDY literal 0 HcmV?d00001 diff --git a/public/javascripts/admin/plugins/shortcut.js b/public/javascripts/admin/plugins/shortcut.js index 9b9c2b7d..1f8bd03c 100644 --- a/public/javascripts/admin/plugins/shortcut.js +++ b/public/javascripts/admin/plugins/shortcut.js @@ -8,19 +8,8 @@ jQuery.fn.saveWithShortcut = function() { form.find('li.error').removeClass('error'); } - // var updateFromWyMeditor = function() { - // if (jQuery.wymeditors == undefined) - // return; - // var i = 0; - // while (jQuery.wymeditors(i) != undefined) { - // var editor = jQuery.wymeditors(i); - // editor.box().prev().val(editor.html()); - // i++; - // } - // }; - var updateFromCodeMirror = function() { - if (CodeMirror == undefined) + if (typeof CodeMirror == undefined) return; jQuery.each(CodeMirrorEditors, function() { this.el.val(this.editor.getCode()); @@ -38,16 +27,15 @@ jQuery.fn.saveWithShortcut = function() { if (data.alert != undefined) { $.growl('error', data.alert); - for (var i = 0; i < data.errors.length; i++) { - var type = data.errors[i][0], value = data.errors[i][1]; - var node = form.find('li:has(#' + data.model + '_' + type + ')'); + for (var field in data.errors) { + var error = data.errors[field]; + var node = form.find('li:has(#' + data.model + '_' + field + ')'); node.addClass('error'); - node.append("

" + value + "

"); + node.append("

" + error + "

"); } form.find('li.error input').eq(0).focus(); } else { $.growl('success', data.notice); - // $.publish('form.saved.success', [data]); } }; @@ -56,7 +44,6 @@ jQuery.fn.saveWithShortcut = function() { jQuery(document).bind('keypress.shortcut', function(event) { if (!(event.which == 115 && (event.ctrlKey || event.metaKey))) return true; - // updateFromWyMeditor(); updateFromCodeMirror(); save(form); event.preventDefault(); diff --git a/public/stylesheets/admin/buttons.css b/public/stylesheets/admin/buttons.css index efe12efc..e1c30995 100644 --- a/public/stylesheets/admin/buttons.css +++ b/public/stylesheets/admin/buttons.css @@ -37,31 +37,26 @@ } .button.small { - background: transparent url(/images/admin/buttons/action-left.png) no-repeat left -40px; + background: #ebedf4; + outline: none; + -moz-border-radius : 10px; + -webkit-border-radius: 10px; color: #787a89; height: 20px; font-size: 0.7em; - padding: 0px 0px 0px 12px; + padding: 0px 12px 0px 12px; color: #8B8D9A !important; text-decoration: none; -} - -.button.small span { - background-image: url(/images/admin/buttons/action-right.png); - text-shadow: 1px 1px 1px #fff; - padding: 0px 12px 10px 0px; - top: 0px; color: #8B8D9A; + text-shadow: 1px 1px 1px #fff; } .button.small.add { - padding-left: 24px; - background-position: 0 0; } -.button.remove, .button.remove span { +.button.remove { color: #ff092c !important; font-size: 1.1em; } -.button.remove:hover span { text-decoration: underline; } \ No newline at end of file +.button.remove:hover { text-decoration: underline; } \ No newline at end of file diff --git a/public/stylesheets/admin/layout.css b/public/stylesheets/admin/layout.css index 9b19dd09..5c848174 100644 --- a/public/stylesheets/admin/layout.css +++ b/public/stylesheets/admin/layout.css @@ -105,32 +105,40 @@ body { #content #local-actions-bar { position: absolute; - top: 15px; + top: 13px; right: 15px; } #content #local-actions-bar a { - display: block; - float: left; - height: 20px; + position: relative; + padding: 2px 10px 3px 31px; color: #8b8d9a; text-decoration: none; font-size: 0.7em; - padding-left: 24px; margin-left: 10px; - background: transparent url(/images/admin/buttons/action-left.png) no-repeat 0 0; + background-color: #ebedf4; outline: none; + -moz-border-radius : 10px; + -webkit-border-radius: 10px; } -#content #local-actions-bar a:hover span { text-decoration: underline; } +#content #local-actions-bar a:hover { text-decoration: underline; } -#content #local-actions-bar a span { - display: inline-block; - height: 13px; - background: transparent url(/images/admin/buttons/action-right.png) no-repeat right 0; - padding: 1px 10px 8px 2px; +#content #local-actions-bar a em { + position: absolute; + display: block; + top: 5px; + left: 10px; + height: 16px; + width: 16px; + background: transparent url(/images/admin/icons/actions.png) no-repeat 0 0; } +#content #local-actions-bar a.show em { background-position: 0 0; } +#content #local-actions-bar a.edit em { background-position: 0 -16px; top: 2px; left: 12px; } +#content #local-actions-bar a.download em { background-position: 0 -32px; } +#content #local-actions-bar a.new em { background-position: 0 -48px; left: 13px; } + /* ___ footer ___ */ #footer { diff --git a/public/stylesheets/admin/menu.css b/public/stylesheets/admin/menu.css index 558504e3..5c490786 100644 --- a/public/stylesheets/admin/menu.css +++ b/public/stylesheets/admin/menu.css @@ -48,12 +48,12 @@ body.contents ul#menu li.contents a em { background-position: 0 -12px; } body.settings ul#menu li.contents { background-position: 0 -80px; } body.settings ul#menu li.contents a { background-position: 0 -80px; } -ul#menu li.assets { background: url(/images/admin/menu/left.png) no-repeat 0 -40px; padding-left: 35px; } -ul#menu li.assets a em { background: transparent url(/images/admin/menu/icons/settings.png) no-repeat 0 0; height: 14px; } +ul#menu li.assets { background: url(/images/admin/menu/left.png) no-repeat 0 -40px; padding-left: 40px; } +ul#menu li.assets a em { background: transparent url(/images/admin/menu/icons/assets.png) no-repeat 0 0; height: 20px; width: 20px; float: left; top: 0px; } body.contents ul#menu li.assets { background-position: 0 0px; } body.assets ul#menu li.assets { background-position: 0 -80px; } body.assets ul#menu li.assets a { background-position: right -80px; color: white; text-shadow: none; } -body.assets ul#menu li.assets a em { background-position: 0 -15px; } +body.assets ul#menu li.assets a em { background-position: 0 -20px; } ul#menu li.assets { background: url(/images/admin/menu/left.png) no-repeat 0 -40px; padding-left: 35px; } ul#menu li.assets a { background: url(/images/admin/menu/right.png) no-repeat right 0px; } diff --git a/spec/models/membership_spec.rb b/spec/models/membership_spec.rb index 4fc3bc1d..0fdbba28 100644 --- a/spec/models/membership_spec.rb +++ b/spec/models/membership_spec.rb @@ -26,29 +26,30 @@ describe Membership do before(:each) do @membership = Factory.build(:membership, :site => Factory.build(:site)) @account = Factory.build(:account) + @account.stubs(:save).returns(true) Account.stubs(:where).returns([@account]) Account.stubs(:find).returns(@account) end it 'should tell error' do - @membership.action_to_take.should == :error + @membership.process!.should == :error end it 'should tell we need to create a new account' do Account.stubs(:where).returns([]) @membership.email = 'homer@simpson' - @membership.action_to_take.should == :create_account + @membership.process!.should == :create_account end it 'should tell nothing to do' do @membership.email = 'bart@simpson.net' @membership.site.stubs(:memberships).returns([@membership, @membership]) - @membership.action_to_take.should == :nothing + @membership.process!.should == :nothing end it 'should tell membership has to be saved' do @membership.email = 'bart@simpson.net' - @membership.action_to_take.should == :save_it + @membership.process!.should == :save_it end end