From cb8af65cafc9487d379f8ebeccd5b77bd9661101 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Sat, 29 Jun 2013 17:59:38 +0200 Subject: [PATCH] UI ameliorations --- app/assets/stylesheets/admin.css.less | 25 ++++++++++++ .../stylesheets/admin/framework/tables.less | 2 +- app/assets/stylesheets/admin/sheets.less | 10 ++--- app/helpers/icon_helper.rb | 15 ++++++- app/views/admin/petitions/index.html.haml | 6 +-- app/views/layouts/admin.html.haml | 8 ++-- app/views/newsletters/index.html.haml | 35 ++++++++++------ app/views/sheets/_sheet.html.haml | 40 +++++++++---------- app/views/sheets/_sheets.html.haml | 4 +- app/views/sheets/edit.html.haml | 6 +-- app/views/sheets/show.html.haml | 4 +- app/views/tiny_urls/index.html.haml | 4 +- 12 files changed, 104 insertions(+), 55 deletions(-) diff --git a/app/assets/stylesheets/admin.css.less b/app/assets/stylesheets/admin.css.less index 77dd68f..b544ff5 100644 --- a/app/assets/stylesheets/admin.css.less +++ b/app/assets/stylesheets/admin.css.less @@ -22,6 +22,31 @@ body.admin{ padding:0px; + +.right{ +float:right; + +} + +.icon{ +border:1px solid #0088cc; +display:inline-block; +padding:6px; +border-radius:50%; +font-size:1.1em; +width:1.1em; +height:1.1em; +text-align:center; +background:white; + +&:hover{ +background:#0088cc; +color:white; +text-decoration:none; +} + + +} #upload_details{ display:none; diff --git a/app/assets/stylesheets/admin/framework/tables.less b/app/assets/stylesheets/admin/framework/tables.less index 0e35271..ce95888 100755 --- a/app/assets/stylesheets/admin/framework/tables.less +++ b/app/assets/stylesheets/admin/framework/tables.less @@ -25,7 +25,7 @@ table { padding: 8px; line-height: @baseLineHeight; text-align: left; - vertical-align: top; + vertical-align: middle; border-top: 1px solid @tableBorder; } th { diff --git a/app/assets/stylesheets/admin/sheets.less b/app/assets/stylesheets/admin/sheets.less index b36e215..904202c 100644 --- a/app/assets/stylesheets/admin/sheets.less +++ b/app/assets/stylesheets/admin/sheets.less @@ -46,12 +46,12 @@ color:white; } -.box-shadow(0px 0px 10px rgba(0,0,0,0.8)); + position:fixed; -top:20px; -left:20px; -right:20px; -bottom:20px; +top:0px; +left:0px; +right:0px; +bottom:0px; z-index:2000; background:white; .content{ diff --git a/app/helpers/icon_helper.rb b/app/helpers/icon_helper.rb index 96c50dc..689a286 100644 --- a/app/helpers/icon_helper.rb +++ b/app/helpers/icon_helper.rb @@ -2,8 +2,19 @@ module IconHelper - def i(icon_name) - raw ('') + def i(icon_name, options = {:icon => true}) + if options[:icon] + + raw ('') + + + else + + raw ('') + end + + + end diff --git a/app/views/admin/petitions/index.html.haml b/app/views/admin/petitions/index.html.haml index 4db7db6..a5bb3d4 100644 --- a/app/views/admin/petitions/index.html.haml +++ b/app/views/admin/petitions/index.html.haml @@ -1,4 +1,4 @@ -= link_to i(:plus)+' Ajouter une petition', new_admin_petition_path, :class => "btn" += link_to i(:plus, :icon => false)+' Ajouter une petition', new_admin_petition_path, :class => "btn" %h1 Liste des petitions en ligne %table.stat_table.table.table-striped @@ -19,7 +19,7 @@ =petition.confirmed_signators_number ="("+(petition.signators_number-petition.confirmed_signators_number).to_s+" en attente)" if petition.signators_number-petition.confirmed_signators_number > 0 %td - = link_to i(:"eye-open"), [:admin, petition] - = link_to i(:pencil), edit_admin_petition_path(petition) = link_to i(:trash), [:admin, petition], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cette petition ? Les signatures seront également supprimées.' } + = link_to i(:pencil), edit_admin_petition_path(petition) + = link_to i(:info), [:admin, petition] diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index 3a82d9c..0e06187 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -31,10 +31,12 @@ - %a.brand{:href => "/admin"} Administration + %a.brand{:href => "/admin"} + =i(:home, :icon => false) + Administration .collapse.nav-collapse %ul.nav - %li=link_to i(:home), "/admin" + %li=link_to "Admins", admin_admins_path %li.dropdown %a{:href => "#", :class => "dropdown-toggle", :data => {:toggle => "dropdown"}} @@ -68,7 +70,7 @@ .container-fluid - + = yield #flashs= bootstrap_flash diff --git a/app/views/newsletters/index.html.haml b/app/views/newsletters/index.html.haml index 4e0fe4b..76e67ed 100755 --- a/app/views/newsletters/index.html.haml +++ b/app/views/newsletters/index.html.haml @@ -1,7 +1,10 @@ -.links - =link_to "Créer une newsletter", new_newsletter_path -%table.admin_table#newsletters-list.table.table-stripped.table-bordered +.right + =link_to i(:plus, :icon => false)+" Créer une newsletter", new_newsletter_path, :class => "btn btn-primary" + +%h1 Newsletters + +%table.admin_table#newsletters-list.table.table-striped %tr %th Expéditeur @@ -17,16 +20,24 @@ =u.email_from %td = u.title - %td + + + + + %td{:style => "text-align:right;"} - if has_permission?('newsletter.send') - =form_tag send_test_newsletter_path(u) do - = text_field_tag :email - = submit_tag "Envoyer un email de test", :class => "lien" - %td.link-column{:style => "width:200px;"} - = link_to "Prévualiser", newsletter_path(u) - = link_to "Editer", edit_newsletter_path(u) - = link_to "Effacer", u, :method => :delete, :confirm => 'Voulez-vous vraiment supprimer cette newsletter ?' - = link_to "Envoyer", select_recipients_newsletter_path(u) + =form_tag send_test_newsletter_path(u), :style => "display:inline;" do + .input-append{:style => "display:inline-block;margin:2px;"} + = text_field_tag :email,"", :class => "" + = submit_tag "Envoyer un email de test", :class => "btn" + + %td{:style => "width:150px;text-align:right;"} + = link_to i(:trash), u, :method => :delete, :confirm => 'Voulez-vous vraiment supprimer cette newsletter ?' + = link_to i(:"envelope-alt"), select_recipients_newsletter_path(u) + = link_to i(:pencil), edit_newsletter_path(u) + = link_to i(:"eye-open"), newsletter_path(u), :target => "_blank" + + diff --git a/app/views/sheets/_sheet.html.haml b/app/views/sheets/_sheet.html.haml index 0d75db3..71e08ff 100644 --- a/app/views/sheets/_sheet.html.haml +++ b/app/views/sheets/_sheet.html.haml @@ -1,22 +1,22 @@ %tr#sheet_line{:id => sheet.id} - -if sheet.corporate and sheet.corporate != "" - %td{:colspan => 2}=sheet.corporate - -else - %td= sheet.person.surname if sheet.person - %td= sheet.person.firstname if sheet.person - %td - -if sheet.person and sheet.person.phone and sheet.person.phone != "" - =sheet.person.phone - -else - =sheet.other_phone - - %td - -if sheet.person and sheet.person.email and sheet.person.email != "" - =sheet.person.email - -else - =sheet.other_mail + -if sheet.corporate and sheet.corporate != "" + %td{:colspan => 2}=sheet.corporate + -else + %td= sheet.person.surname if sheet.person + %td= sheet.person.firstname if sheet.person + %td + -if sheet.person and sheet.person.phone and sheet.person.phone != "" + =sheet.person.phone + -else + =sheet.other_phone + + %td.hidden-phone + -if sheet.person and sheet.person.email and sheet.person.email != "" + =sheet.person.email + -else + =sheet.other_mail - %td.link-column - =link_to 'Modifier', edit_sheet_path(sheet), :method => :get, :remote => true - =link_to "Voir", sheet, :class => "lien", :remote => true - =link_to "Supprimer", sheet, :method => :delete, :confirm => "*********ATTENTION*********\n Supprimer cette fiche entrainera la suppression de toutes traces concernant celle-ci : y compris les traces d'années d'adhésion, pouvant donc fausser les statistiques de l'ensemble du fichier. \n \nVous pouvez convertir la fiche en fiche 'sympathisant'.\n\n\ Pour annuler cliquez sur 'annuler', pour supprimer cette fiche malgrès cet avertissement cliquez sur 'OK'. \n\n", :class => "lien" \ No newline at end of file + %td.link-column + =link_to i(:trash), sheet, :method => :delete, :confirm => "*********ATTENTION*********\n Supprimer cette fiche entrainera la suppression de toutes traces concernant celle-ci : y compris les traces d'années d'adhésion, pouvant donc fausser les statistiques de l'ensemble du fichier. \n \nVous pouvez convertir la fiche en fiche 'sympathisant'.\n\n\ Pour annuler cliquez sur 'annuler', pour supprimer cette fiche malgrès cet avertissement cliquez sur 'OK'. \n\n", :class => "lien" + =link_to i(:info), sheet, :class => "lien", :remote => true + =link_to i(:pencil), edit_sheet_path(sheet), :method => :get, :remote => true \ No newline at end of file diff --git a/app/views/sheets/_sheets.html.haml b/app/views/sheets/_sheets.html.haml index 45c0eb5..9f6d50a 100644 --- a/app/views/sheets/_sheets.html.haml +++ b/app/views/sheets/_sheets.html.haml @@ -7,6 +7,6 @@ résultats %th Nom %th Prénom %th Téléphone - %th Email - %th + %th.hidden-phone Email + %th{:style => "width:100px;"} =render @sheets.sort{|u,v| ((u.person.surname if u.person) || u.corporate).to_s <=>(( v.person.surname if v.person )|| v.corporate).to_s} \ No newline at end of file diff --git a/app/views/sheets/edit.html.haml b/app/views/sheets/edit.html.haml index e87d2cb..258c48b 100644 --- a/app/views/sheets/edit.html.haml +++ b/app/views/sheets/edit.html.haml @@ -1,8 +1,8 @@ #sheet_show.edit .links - =link_to "Détail", @sheet, :class => "button", :remote => true, :confirm => "Attention, les changements éventuellements apportés ne seront pas sauvegardés." - = link_to 'Fermer', "#",:class => "button", :onclick => "$('#sheet_show').remove();$('body').css('overflow', 'auto');return false;" - %input{:type => "submit", :onclick => "$(this).closest('#sheet_show').find('form').submit();return false;", :value => "Sauvegarder"} + =link_to i(:info), @sheet, :class => "button", :remote => true, :confirm => "Attention, les changements éventuellements apportés ne seront pas sauvegardés." + = link_to i(:remove), "#",:class => "button", :onclick => "$('#sheet_show').remove();$('body').css('overflow', 'auto');return false;" + %input{:type => "submit", :onclick => "$(this).closest('#sheet_show').find('form').submit();return false;", :value => "Sauvegarder", :class => "btn"} .content %h1 Modifier une fiche diff --git a/app/views/sheets/show.html.haml b/app/views/sheets/show.html.haml index ff80a89..c350a08 100644 --- a/app/views/sheets/show.html.haml +++ b/app/views/sheets/show.html.haml @@ -1,7 +1,7 @@ #sheet_show.show .links - = link_to 'Modifier', edit_sheet_path(@sheet), :class => "button", :method => :get, :remote => true - = link_to 'Fermer', "#", :class => "button", :onclick => "$('#sheet_show').remove();$('body').css('overflow', 'auto');return false;" + = link_to i(:pencil), edit_sheet_path(@sheet), :class => "button", :method => :get, :remote => true + = link_to i(:remove), "#", :class => "button", :onclick => "$('#sheet_show').remove();$('body').css('overflow', 'auto');return false;" diff --git a/app/views/tiny_urls/index.html.haml b/app/views/tiny_urls/index.html.haml index b9d98b6..d4b26c2 100644 --- a/app/views/tiny_urls/index.html.haml +++ b/app/views/tiny_urls/index.html.haml @@ -1,4 +1,4 @@ -= link_to i(:plus)+' Ajouter une url courte', new_tiny_url_path, :class => "btn" += link_to i(:plus, :icon => false)+' Ajouter une url courte', new_tiny_url_path, :class => "btn" %h1 Liste des urls courtes %table.stat_table.table.table-striped.table-hover @@ -15,6 +15,6 @@ %td= tiny_url.url %td= tiny_url.nbr_views %td - = link_to i(:pencil), edit_tiny_url_path(tiny_url) = link_to i(:trash), tiny_url, method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cette url ? Le lien deviendra mort.' } + = link_to i(:pencil), edit_tiny_url_path(tiny_url)