diff --git a/app/controllers/newsgroups_controller.rb b/app/controllers/admin/newsgroups_controller.rb similarity index 76% rename from app/controllers/newsgroups_controller.rb rename to app/controllers/admin/newsgroups_controller.rb index 1fd61b1..9638819 100644 --- a/app/controllers/newsgroups_controller.rb +++ b/app/controllers/admin/newsgroups_controller.rb @@ -1,6 +1,6 @@ # -*- encoding : utf-8 -*- -class NewsgroupsController < ApplicationController +class Admin::NewsgroupsController < ApplicationController layout 'admin' @@ -18,8 +18,6 @@ class NewsgroupsController < ApplicationController end end - # GET /newsgroups/1 - # GET /newsgroups/1.xml def show @newsgroup = Newsgroup.find(params[:id]) @@ -29,8 +27,6 @@ class NewsgroupsController < ApplicationController end end - # GET /newsgroups/new - # GET /newsgroups/new.xml def new @newsgroup = Newsgroup.new @@ -40,13 +36,11 @@ class NewsgroupsController < ApplicationController end end - # GET /newsgroups/1/edit def edit @newsgroup = Newsgroup.find(params[:id]) end - # POST /newsgroups - # POST /newsgroups.xml + def create @newsgroup = Newsgroup.new(params[:newsgroup]) @@ -61,13 +55,11 @@ class NewsgroupsController < ApplicationController end - # PUT /newsgroups/1 - # PUT /newsgroups/1.xml def update @newsgroup = Newsgroup.find(params[:id]) if @newsgroup.update_attributes(params[:newsgroup]) flash[:notice] = 'Le groupe à bien été éditer.' - redirect_to(newsgroups_url) + redirect_to :action => :index else render :action => "edit" @@ -76,15 +68,11 @@ class NewsgroupsController < ApplicationController end - # DELETE /newsgroups/1 - # DELETE /newsgroups/1.xml + def destroy @newsgroup = Newsgroup.find(params[:id]) @newsgroup.destroy flash[:notice] = 'Le groupe à bien été supprimé.' - respond_to do |format| - format.html { redirect_to(newsgroups_url) } - format.xml { head :ok } - end + redirect_to :action => :index end end diff --git a/app/controllers/admin/note_files_controller.rb b/app/controllers/admin/note_files_controller.rb new file mode 100644 index 0000000..7db4849 --- /dev/null +++ b/app/controllers/admin/note_files_controller.rb @@ -0,0 +1,35 @@ +# -*- encoding : utf-8 -*- +class Admin::NoteFilesController < ApplicationController + + + def show + @note_file = NoteFile.find(params[:id]) + + + if params[:inline] and !params[:force] + + else + send_file @note_file.file.path, :filename => @note_file.abstract_file_name_slug, :disposition => (params[:download] ? "attachment" : "inline") + end + + end + + + def create + + @note_file = NoteFile.new(:original_filename => params[:files][0].original_filename ,:name => params[:files][0].original_filename, :note_id => params[:note_id], :file =>params[:files][0]) + + if @note_file.save + + else + + end + + end + + def destroy + @note_file = NoteFile.find(params[:id]) + @note_file.destroy + + end +end diff --git a/app/controllers/notes_controller.rb b/app/controllers/admin/notes_controller.rb similarity index 92% rename from app/controllers/notes_controller.rb rename to app/controllers/admin/notes_controller.rb index 053243b..924dd89 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/admin/notes_controller.rb @@ -1,5 +1,5 @@ # -*- encoding : utf-8 -*- -class NotesController < ApplicationController +class Admin::NotesController < ApplicationController def show @note = Note.find(params[:id]) diff --git a/app/controllers/people_controller.rb b/app/controllers/admin/people_controller.rb similarity index 100% rename from app/controllers/people_controller.rb rename to app/controllers/admin/people_controller.rb diff --git a/app/controllers/sheet_years_controller.rb b/app/controllers/admin/sheet_years_controller.rb similarity index 100% rename from app/controllers/sheet_years_controller.rb rename to app/controllers/admin/sheet_years_controller.rb diff --git a/app/controllers/sheets_controller.rb b/app/controllers/admin/sheets_controller.rb similarity index 92% rename from app/controllers/sheets_controller.rb rename to app/controllers/admin/sheets_controller.rb index db926eb..c370136 100644 --- a/app/controllers/sheets_controller.rb +++ b/app/controllers/admin/sheets_controller.rb @@ -1,8 +1,8 @@ # -*- encoding : utf-8 -*- -class SheetsController < ApplicationController +class Admin::SheetsController < ApplicationController - before_filter :authenticate_admin!, except: [:show] + before_filter :authenticate_admin! layout "admin" @@ -59,14 +59,7 @@ require 'iconv' format.csv { send_data @sheets.to_csv2 } format.xls - - # report.rewind - - # converter = Iconv.new('ISO-8859-15//IGNORE//TRANSLIT','UTF-8') - # send_data( converter.iconv(report.read),:type => 'text/csv;',:filename => 'exporation-adherents.csv',:encoding => 'UTF-16') - - - #} + end end @@ -74,11 +67,6 @@ require 'iconv' def show @sheet = Sheet.find(params[:id]) - respond_to do |format| - format.html # show.html.erb - format.js - format.xml { render :xml => @sheet } - end end @@ -103,7 +91,7 @@ require 'iconv' respond_to do |format| if @sheet.save flash[:notice] = 'Sheet was successfully created.' - format.html { redirect_to(@sheet) } + format.js { render :action => "show" } else format.html { render :action => "new" } @@ -132,10 +120,8 @@ require 'iconv' @sheet = Sheet.find(params[:id]) @sheet.destroy - respond_to do |format| - format.html { redirect_to(sheets_url) } - format.xml { head :ok } - end + redirect_to(admin_sheets_url) + end diff --git a/app/controllers/topics_controller.rb b/app/controllers/admin/topics_controller.rb similarity index 93% rename from app/controllers/topics_controller.rb rename to app/controllers/admin/topics_controller.rb index 7feb381..2807a90 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/admin/topics_controller.rb @@ -1,5 +1,5 @@ # -*- encoding : utf-8 -*- -class TopicsController < ApplicationController +class Admin::TopicsController < ApplicationController before_filter :authenticate_admin! layout "admin" diff --git a/app/controllers/note_files_controller.rb b/app/controllers/note_files_controller.rb deleted file mode 100644 index 8c24025..0000000 --- a/app/controllers/note_files_controller.rb +++ /dev/null @@ -1,83 +0,0 @@ -# -*- encoding : utf-8 -*- -class NoteFilesController < ApplicationController - # GET /note_files - # GET /note_files.json - def index - @note_files = NoteFile.all - - respond_to do |format| - format.html # index.html.erb - format.json { render json: @note_files } - end - end - - # GET /note_files/1 - # GET /note_files/1.json - def show - @note_file = NoteFile.find(params[:id]) - - - if params[:inline] and !params[:force] - - else - send_file @note_file.file.path, :filename => @note_file.abstract_file_name_slug, :disposition => (params[:download] ? "attachment" : "inline") - end - - end - - # GET /note_files/new - # GET /note_files/new.json - def new - @note_file = NoteFile.new - - respond_to do |format| - format.html # new.html.erb - format.json { render json: @note_file } - end - end - - # GET /note_files/1/edit - def edit - @note_file = NoteFile.find(params[:id]) - end - - # POST /note_files - # POST /note_files.json - def create - puts "AAAAAAAAAAAAAAAA" - puts params[:files][0].original_filename - puts "AAAAAAAAAAAAAAAA" - @note_file = NoteFile.new(:original_filename => params[:files][0].original_filename ,:name => params[:files][0].original_filename, :note_id => params[:note_id], :file =>params[:files][0]) - - if @note_file.save - - else - - end - - end - - # PUT /note_files/1 - # PUT /note_files/1.json - def update - @note_file = NoteFile.find(params[:id]) - - respond_to do |format| - if @note_file.update_attributes(params[:note_file]) - format.html { redirect_to @note_file, notice: 'Note file was successfully updated.' } - format.json { head :no_content } - else - format.html { render action: "edit" } - format.json { render json: @note_file.errors, status: :unprocessable_entity } - end - end - end - - # DELETE /note_files/1 - # DELETE /note_files/1.json - def destroy - @note_file = NoteFile.find(params[:id]) - @note_file.destroy - - end -end diff --git a/app/helpers/document_line_helper.rb b/app/helpers/document_line_helper.rb index 465007e..fa7c2d5 100644 --- a/app/helpers/document_line_helper.rb +++ b/app/helpers/document_line_helper.rb @@ -9,7 +9,7 @@ module DocumentLineHelper def link_to_add_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new() fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| - render(association.to_s + "/form", :form => builder) + render("admin/"+association.to_s + "/form", :form => builder) end link_to_function(name, "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\");") end diff --git a/app/views/donates/_donate.html.haml b/app/views/admin/donates/_donate.html.haml similarity index 100% rename from app/views/donates/_donate.html.haml rename to app/views/admin/donates/_donate.html.haml diff --git a/app/views/donates/_form.html.haml b/app/views/admin/donates/_form.html.haml similarity index 100% rename from app/views/donates/_form.html.haml rename to app/views/admin/donates/_form.html.haml diff --git a/app/views/newsgroups/_form.html.haml b/app/views/admin/newsgroups/_form.html.haml similarity index 85% rename from app/views/newsgroups/_form.html.haml rename to app/views/admin/newsgroups/_form.html.haml index 44206a0..815bcf3 100644 --- a/app/views/newsgroups/_form.html.haml +++ b/app/views/admin/newsgroups/_form.html.haml @@ -1,4 +1,4 @@ -= form_for(@newsgroup) do |f| += form_for([:admin, @newsgroup]) do |f| %table diff --git a/app/views/newsgroups/edit.html.haml b/app/views/admin/newsgroups/edit.html.haml similarity index 100% rename from app/views/newsgroups/edit.html.haml rename to app/views/admin/newsgroups/edit.html.haml diff --git a/app/views/admin/newsgroups/index.html.haml b/app/views/admin/newsgroups/index.html.haml new file mode 100644 index 0000000..b6af022 --- /dev/null +++ b/app/views/admin/newsgroups/index.html.haml @@ -0,0 +1,30 @@ + + +.links + = link_to 'Ajouter un groupe', new_admin_newsgroup_path, :class => "lien" if has_permission?('adherent.add') + + + +%h1 Liste des groupes + +%table.admin_table + %thead + %tr + %th{:style=>"width:80%;"} Nom du groupe + %th{:style=>"width:20%;"} + %tbody + -@newsgroups.each do |newsgroup| + %tr + %td=h newsgroup.name + + + %td.link-column + =link = link_to( 'Editer', edit_admin_newsgroup_path(newsgroup),:class => "lien" ) if has_permission?('adherent.edit') + =link = link_to('Supprimer', [:admin, newsgroup], :confirm => 'Êtes-vous sure de supprimer le groupe ?', :method => :delete, :class => "lien") if has_permission?('adherent.delete') + + + +%br + + + diff --git a/app/views/newsgroups/new.html.haml b/app/views/admin/newsgroups/new.html.haml similarity index 100% rename from app/views/newsgroups/new.html.haml rename to app/views/admin/newsgroups/new.html.haml diff --git a/app/views/note_files/_form.html.haml b/app/views/admin/note_files/_form.html.haml similarity index 52% rename from app/views/note_files/_form.html.haml rename to app/views/admin/note_files/_form.html.haml index 9c79e37..2c6d030 100644 --- a/app/views/note_files/_form.html.haml +++ b/app/views/admin/note_files/_form.html.haml @@ -1,9 +1,9 @@ -%form.fileupload{:action => note_files_path(:note_id => note.id), :enctype => "multipart/form-data", :method => "POST"} +%form.fileupload{:action => admin_note_files_path(:note_id => note.id), :enctype => "multipart/form-data", :method => "POST"} .upload - %button.add_files ajouter des fichiers + %button.add_files.btn ajouter des fichiers - %input{:multiple => "", :name => "files[]", :type => "file", :style => "float:right;"} + %input{:multiple => "", :name => "files[]", :type => "file", :style => "float:right;display:none;"} .progress diff --git a/app/views/admin/note_files/_note_file.html.haml b/app/views/admin/note_files/_note_file.html.haml new file mode 100644 index 0000000..004c24d --- /dev/null +++ b/app/views/admin/note_files/_note_file.html.haml @@ -0,0 +1,9 @@ +.note_file#note_file{:id => note_file.id} + -ext = File.extname(note_file.file.path)[1..-1] + %div{:style => "display:inline-block;text-align:center;width:30px;"}=image_tag "admin/file_types/"+ext+".png" + =l note_file.created_at, :format => :short + =note_file.name + =link_to "supprimer", admin_note_file_path(note_file), :remote => true, :method => :delete, :confirm => "Voulez-vous vraiment supprimer ce fichier ?" + =link_to "voir", admin_note_file_path(note_file), :target => "_blank" + =link_to "télécharger", admin_note_file_path(note_file, :download => true) + \ No newline at end of file diff --git a/app/views/note_files/_show.html.haml b/app/views/admin/note_files/_show.html.haml similarity index 53% rename from app/views/note_files/_show.html.haml rename to app/views/admin/note_files/_show.html.haml index c34dc44..04dbe7a 100644 --- a/app/views/note_files/_show.html.haml +++ b/app/views/admin/note_files/_show.html.haml @@ -1,4 +1,4 @@ %a{:href => "#", :onclick => "$(this).closest('#file_prev').remove();return false;"} retour -%iframe{:src => note_file_path(@note_file, :inline => true, :force => true)} +%iframe{:src => admin_note_file_path(@note_file, :inline => true, :force => true)} diff --git a/app/views/note_files/create.js.erb b/app/views/admin/note_files/create.js.erb similarity index 100% rename from app/views/note_files/create.js.erb rename to app/views/admin/note_files/create.js.erb diff --git a/app/views/note_files/destroy.js.erb b/app/views/admin/note_files/destroy.js.erb similarity index 100% rename from app/views/note_files/destroy.js.erb rename to app/views/admin/note_files/destroy.js.erb diff --git a/app/views/note_files/show.js.erb b/app/views/admin/note_files/show.js.erb similarity index 100% rename from app/views/note_files/show.js.erb rename to app/views/admin/note_files/show.js.erb diff --git a/app/views/notes/_form.html.haml b/app/views/admin/notes/_form.html.haml similarity index 69% rename from app/views/notes/_form.html.haml rename to app/views/admin/notes/_form.html.haml index 4db2ad6..fe6cd81 100644 --- a/app/views/notes/_form.html.haml +++ b/app/views/admin/notes/_form.html.haml @@ -1,6 +1,6 @@ #note_form %p ``` - = form_for @note, :remote => true do |f| + = form_for [:admin, @note], :remote => true do |f| =f.hidden_field :topic_id =f.text_area :message, :class => "markdown" diff --git a/app/views/notes/_note.haml b/app/views/admin/notes/_note.haml similarity index 59% rename from app/views/notes/_note.haml rename to app/views/admin/notes/_note.haml index 93cd4e7..1ff238f 100644 --- a/app/views/notes/_note.haml +++ b/app/views/admin/notes/_note.haml @@ -10,12 +10,12 @@ .date=l note.created_at, :format => :short .right .links - =link_to "modifier", edit_note_path(note), :remote => true - =link_to "suprimer", note_path(note), :remote => true, :method => :delete, :confirm => "Voulez-vous vraiment supprimer cette note ?" + =link_to "modifier", edit_admin_note_path(note), :remote => true + =link_to "suprimer", admin_note_path(note), :remote => true, :method => :delete, :confirm => "Voulez-vous vraiment supprimer cette note ?" =markdown note.message .bottom - =render :partial => "note_files/form", :locals => {:note => note} + =render :partial => "admin/note_files/form", :locals => {:note => note} #note_files.note_files{:id => note.id}=render note.note_files :javascript diff --git a/app/views/notes/create.js.erb b/app/views/admin/notes/create.js.erb similarity index 100% rename from app/views/notes/create.js.erb rename to app/views/admin/notes/create.js.erb diff --git a/app/views/notes/destroy.js.erb b/app/views/admin/notes/destroy.js.erb similarity index 100% rename from app/views/notes/destroy.js.erb rename to app/views/admin/notes/destroy.js.erb diff --git a/app/views/notes/edit.js.erb b/app/views/admin/notes/edit.js.erb similarity index 100% rename from app/views/notes/edit.js.erb rename to app/views/admin/notes/edit.js.erb diff --git a/app/views/notes/new.js.erb b/app/views/admin/notes/new.js.erb similarity index 100% rename from app/views/notes/new.js.erb rename to app/views/admin/notes/new.js.erb diff --git a/app/views/notes/update.js.erb b/app/views/admin/notes/update.js.erb similarity index 100% rename from app/views/notes/update.js.erb rename to app/views/admin/notes/update.js.erb diff --git a/app/views/people/_form.html.haml b/app/views/admin/people/_form.html.haml similarity index 100% rename from app/views/people/_form.html.haml rename to app/views/admin/people/_form.html.haml diff --git a/app/views/people/_person.html.haml b/app/views/admin/people/_person.html.haml similarity index 100% rename from app/views/people/_person.html.haml rename to app/views/admin/people/_person.html.haml diff --git a/app/views/sheet_years/_form.html.haml b/app/views/admin/sheet_years/_form.html.haml similarity index 100% rename from app/views/sheet_years/_form.html.haml rename to app/views/admin/sheet_years/_form.html.haml diff --git a/app/views/sheet_years/_sheet_year.html.haml b/app/views/admin/sheet_years/_sheet_year.html.haml similarity index 100% rename from app/views/sheet_years/_sheet_year.html.haml rename to app/views/admin/sheet_years/_sheet_year.html.haml diff --git a/app/views/sheets/_edit.js.erb b/app/views/admin/sheets/_edit.js.erb similarity index 100% rename from app/views/sheets/_edit.js.erb rename to app/views/admin/sheets/_edit.js.erb diff --git a/app/views/sheets/_form.html.haml b/app/views/admin/sheets/_form.html.haml similarity index 82% rename from app/views/sheets/_form.html.haml rename to app/views/admin/sheets/_form.html.haml index 42eb47b..92911fc 100644 --- a/app/views/sheets/_form.html.haml +++ b/app/views/admin/sheets/_form.html.haml @@ -8,7 +8,7 @@ .people_form =form.semantic_fields_for :people do |form| - =render :partial => "people/form", :locals => {:form => form} + =render :partial => "admin/people/form", :locals => {:form => form} %h3 Généralités @@ -25,13 +25,13 @@ %p= link_to_add_fields "Ajouter une année", form, :sheet_years .sheet_years_form =form.semantic_fields_for :sheet_years do |form| - =render :partial => "sheet_years/form", :locals => {:form => form} + =render :partial => "admin/sheet_years/form", :locals => {:form => form} %h3 Dons %p= link_to_add_fields "Ajouter un don", form, :donates .donates_form =form.semantic_fields_for :donates do |form| - =render :partial => "donates/form", :locals => {:form => form} + =render :partial => "admin/donates/form", :locals => {:form => form} = form.submit 'Enregistrer', :class => "btn" diff --git a/app/views/sheets/_recu.html.haml b/app/views/admin/sheets/_recu.html.haml similarity index 100% rename from app/views/sheets/_recu.html.haml rename to app/views/admin/sheets/_recu.html.haml diff --git a/app/views/admin/sheets/_sheet.html.haml b/app/views/admin/sheets/_sheet.html.haml new file mode 100644 index 0000000..45d71e6 --- /dev/null +++ b/app/views/admin/sheets/_sheet.html.haml @@ -0,0 +1,24 @@ +%tr#sheet_line{:id => sheet.id} + %td.hidden-phone + =sheet.sheet_number + -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 i(:trash), [:admin, 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), [:admin, sheet], :class => "lien", :remote => true + =link_to i(:pencil), edit_admin_sheet_path(sheet), :method => :get, :remote => true \ No newline at end of file diff --git a/app/views/sheets/_sheet_detail.html.haml b/app/views/admin/sheets/_sheet_detail.html.haml similarity index 100% rename from app/views/sheets/_sheet_detail.html.haml rename to app/views/admin/sheets/_sheet_detail.html.haml diff --git a/app/views/sheets/_sheets.html.haml b/app/views/admin/sheets/_sheets.html.haml similarity index 100% rename from app/views/sheets/_sheets.html.haml rename to app/views/admin/sheets/_sheets.html.haml diff --git a/app/views/sheets/_sheets_search.html.haml b/app/views/admin/sheets/_sheets_search.html.haml similarity index 100% rename from app/views/sheets/_sheets_search.html.haml rename to app/views/admin/sheets/_sheets_search.html.haml diff --git a/app/views/sheets/edit.html.haml b/app/views/admin/sheets/edit.html.haml similarity index 63% rename from app/views/sheets/edit.html.haml rename to app/views/admin/sheets/edit.html.haml index 258c48b..9869397 100644 --- a/app/views/sheets/edit.html.haml +++ b/app/views/admin/sheets/edit.html.haml @@ -1,13 +1,13 @@ #sheet_show.edit .links - =link_to i(:info), @sheet, :class => "button", :remote => true, :confirm => "Attention, les changements éventuellements apportés ne seront pas sauvegardés." + =link_to i(:info), [:admin, @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 - = semantic_form_for [@sheet], :remote => true do |form| + = semantic_form_for [:admin, @sheet], :remote => true do |form| =render :partial => "form", :locals => {:form => form} \ No newline at end of file diff --git a/app/views/admin/sheets/edit.js.erb b/app/views/admin/sheets/edit.js.erb new file mode 100644 index 0000000..249aa78 --- /dev/null +++ b/app/views/admin/sheets/edit.js.erb @@ -0,0 +1,3 @@ +$('#sheet_show').remove(); +$('body').append("<%= escape_javascript(render(:template => "admin/sheets/edit.html.haml")); %>"); +$("body").css("overflow", "hidden"); \ No newline at end of file diff --git a/app/views/sheets/index.html.haml b/app/views/admin/sheets/index.html.haml similarity index 69% rename from app/views/sheets/index.html.haml rename to app/views/admin/sheets/index.html.haml index 4853330..41bc5f5 100644 --- a/app/views/sheets/index.html.haml +++ b/app/views/admin/sheets/index.html.haml @@ -3,7 +3,7 @@ -y = last_year #stat_years - =link_to "fiches", sheets_path() + =link_to "fiches", admin_sheets_path() | Stats : -while y >= first_year @@ -17,12 +17,12 @@ %h1 Liste des fiches =render :partial => "sheets_search", :locals => {:url => ""} %br -= link_to 'Ajouter une fiche', new_sheet_path, :remote => true, :class => "btn" += link_to 'Ajouter une fiche', new_admin_sheet_path, :remote => true, :class => "btn" %br %br #sheets =render :partial => "sheets" -=link_to "Exporter au format XLS", sheets_path(:format => :xls), :class => "btn" +=link_to "Exporter au format XLS", admin_sheets_path(:format => :xls), :class => "btn" %br %br diff --git a/app/views/sheets/index.js.erb b/app/views/admin/sheets/index.js.erb similarity index 100% rename from app/views/sheets/index.js.erb rename to app/views/admin/sheets/index.js.erb diff --git a/app/views/sheets/index.xls.erb b/app/views/admin/sheets/index.xls.erb similarity index 100% rename from app/views/sheets/index.xls.erb rename to app/views/admin/sheets/index.xls.erb diff --git a/app/views/sheets/new.html.haml b/app/views/admin/sheets/new.html.haml similarity index 78% rename from app/views/sheets/new.html.haml rename to app/views/admin/sheets/new.html.haml index 526453f..ee8ee09 100644 --- a/app/views/sheets/new.html.haml +++ b/app/views/admin/sheets/new.html.haml @@ -5,7 +5,7 @@ .content %h1 Nouvelle fiche - = semantic_form_for [@sheet], :remote => true do |form| + = semantic_form_for [:admin, @sheet], :remote => true do |form| =render :partial => "form", :locals => {:form => form} \ No newline at end of file diff --git a/app/views/admin/sheets/new.js.erb b/app/views/admin/sheets/new.js.erb new file mode 100644 index 0000000..fc3c139 --- /dev/null +++ b/app/views/admin/sheets/new.js.erb @@ -0,0 +1,3 @@ +$('#sheet_show').remove(); +$('body').append("<%= escape_javascript(render(:template => "admin/sheets/new.html.haml")); %>"); +$("body").css("overflow", "hidden"); \ No newline at end of file diff --git a/app/views/sheets/recus.html.haml b/app/views/admin/sheets/recus.html.haml similarity index 100% rename from app/views/sheets/recus.html.haml rename to app/views/admin/sheets/recus.html.haml diff --git a/app/views/sheets/show.html.haml b/app/views/admin/sheets/show.html.haml similarity index 72% rename from app/views/sheets/show.html.haml rename to app/views/admin/sheets/show.html.haml index c350a08..3626e58 100644 --- a/app/views/sheets/show.html.haml +++ b/app/views/admin/sheets/show.html.haml @@ -1,6 +1,6 @@ #sheet_show.show .links - = link_to i(:pencil), edit_sheet_path(@sheet), :class => "button", :method => :get, :remote => true + = link_to i(:pencil), edit_admin_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;" @@ -20,7 +20,7 @@ %h2 Cette adhésion regroupe : - = link_to 'Ajouter', :class => "button", :url => new_person_path(:sheet_id => @sheet), :update => "new_sheet_people", :method => :get, :remote => true #if has_permission?('adherent.edit') + #new_sheet_people #sheet_peoples =render @sheet.people diff --git a/app/views/admin/sheets/show.js.erb b/app/views/admin/sheets/show.js.erb new file mode 100644 index 0000000..929fca3 --- /dev/null +++ b/app/views/admin/sheets/show.js.erb @@ -0,0 +1,3 @@ +$('#sheet_show').remove(); +$('body').append("<%= escape_javascript(render(:template => "admin/sheets/show.html.haml")); %>"); +$("body").css("overflow", "hidden"); \ No newline at end of file diff --git a/app/views/sheets/stats.html.haml b/app/views/admin/sheets/stats.html.haml similarity index 98% rename from app/views/sheets/stats.html.haml rename to app/views/admin/sheets/stats.html.haml index 2769dbd..36f33cd 100644 --- a/app/views/sheets/stats.html.haml +++ b/app/views/admin/sheets/stats.html.haml @@ -3,7 +3,7 @@ -y = last_year #stat_years - =link_to "fiches", sheets_path() + =link_to "fiches", admin_sheets_path() | Stats : -while y >= first_year diff --git a/app/views/sheets/update.html.haml b/app/views/admin/sheets/update.html.haml similarity index 100% rename from app/views/sheets/update.html.haml rename to app/views/admin/sheets/update.html.haml diff --git a/app/views/sheets/update.js.erb b/app/views/admin/sheets/update.js.erb similarity index 100% rename from app/views/sheets/update.js.erb rename to app/views/admin/sheets/update.js.erb diff --git a/app/views/topics/_form.html.haml b/app/views/admin/topics/_form.html.haml similarity index 92% rename from app/views/topics/_form.html.haml rename to app/views/admin/topics/_form.html.haml index dae01ca..a3c3382 100644 --- a/app/views/topics/_form.html.haml +++ b/app/views/admin/topics/_form.html.haml @@ -1,4 +1,4 @@ -= form_for @topic do |f| += form_for [:admin, @topic] do |f| -if @topic.errors.any? #error_explanation %h2= "#{pluralize(@topic.errors.count, "error")} prohibited this topic from being saved:" diff --git a/app/views/admin/topics/_show.html.haml b/app/views/admin/topics/_show.html.haml new file mode 100644 index 0000000..deb16af --- /dev/null +++ b/app/views/admin/topics/_show.html.haml @@ -0,0 +1,15 @@ +.topic_links + = link_to 'Modifier', edit_admin_topic_path(@topic), :remote => true + = link_to 'Suprimer', admin_topic_path(@topic), :remote => true, :method => :delete, :confirm => "Voulez-vous vraiment supprimer ce topic, et tout son contenu ?" + + + +%h1.topic_title= @topic.title +%p + Lancé par + = @topic.admin.username + +#notes=render @topic.notes +=link_to "Ajouter une note", new_admin_note_path(:topic_id => @topic), :remote => true, :id => "add_note" + +#note_form_place diff --git a/app/views/admin/topics/_topic.haml b/app/views/admin/topics/_topic.haml new file mode 100644 index 0000000..0cbaa83 --- /dev/null +++ b/app/views/admin/topics/_topic.haml @@ -0,0 +1 @@ += link_to topic.title, [:admin, topic], :class => "topic_line", :remote => true, :id => "topic_line_#{topic.id}" diff --git a/app/views/topics/create.js.erb b/app/views/admin/topics/create.js.erb similarity index 100% rename from app/views/topics/create.js.erb rename to app/views/admin/topics/create.js.erb diff --git a/app/views/topics/destroy.js.erb b/app/views/admin/topics/destroy.js.erb similarity index 100% rename from app/views/topics/destroy.js.erb rename to app/views/admin/topics/destroy.js.erb diff --git a/app/views/topics/edit.js.erb b/app/views/admin/topics/edit.js.erb similarity index 76% rename from app/views/topics/edit.js.erb rename to app/views/admin/topics/edit.js.erb index 1a14f15..0c9d768 100644 --- a/app/views/topics/edit.js.erb +++ b/app/views/admin/topics/edit.js.erb @@ -3,7 +3,7 @@ var new_topic_name = prompt("Topic :\n <%= "Vous n'avez spécifié aucun nom pou if(new_topic_name){ - $.ajax({url : '<%= topic_path(@topic) %>', type: "PUT", data : { + $.ajax({url : '<%= admin_topic_path(@topic) %>', type: "PUT", data : { topic : { title: new_topic_name } diff --git a/app/views/admin/topics/index.html.haml b/app/views/admin/topics/index.html.haml new file mode 100644 index 0000000..e531efb --- /dev/null +++ b/app/views/admin/topics/index.html.haml @@ -0,0 +1,14 @@ +#topic_app_index + + + #left + = link_to '+ ajouter un topic', new_admin_topic_path, :remote => true, :id => "add_topic" + + #topics=render @topics + + + + + + #topic_show + \ No newline at end of file diff --git a/app/views/topics/new.js.erb b/app/views/admin/topics/new.js.erb similarity index 77% rename from app/views/topics/new.js.erb rename to app/views/admin/topics/new.js.erb index ef31598..aab5901 100644 --- a/app/views/topics/new.js.erb +++ b/app/views/admin/topics/new.js.erb @@ -3,7 +3,7 @@ var new_topic_name = prompt("Topic :\n <%= "Vous n'avez spécifié aucun nom pou if(new_topic_name){ - $.ajax({url : '<%= topics_path() %>', type: "POST", data : { + $.ajax({url : '<%= admin_topics_path() %>', type: "POST", data : { topic : { title: new_topic_name } diff --git a/app/views/topics/show.js.erb b/app/views/admin/topics/show.js.erb similarity index 100% rename from app/views/topics/show.js.erb rename to app/views/admin/topics/show.js.erb diff --git a/app/views/topics/update.js.erb b/app/views/admin/topics/update.js.erb similarity index 100% rename from app/views/topics/update.js.erb rename to app/views/admin/topics/update.js.erb diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml index d0f1719..453033a 100644 --- a/app/views/layouts/admin.html.haml +++ b/app/views/layouts/admin.html.haml @@ -43,7 +43,7 @@ Adhérents %b.caret %ul.dropdown-menu - %li=link_to "liste des adhérents", sheets_path + %li=link_to "liste des adhérents", admin_sheets_path %li=link_to "gestion newsletters", newsletters_path %li.divider %li=link_to "Sondages", admin_survey_types_path @@ -52,7 +52,7 @@ - %li=link_to "notes", topics_path + %li=link_to "notes", admin_topics_path %li=link_to "urls courtes", admin_tiny_urls_path %ul.nav.pull-right diff --git a/app/views/newsgroups/index.html.haml b/app/views/newsgroups/index.html.haml deleted file mode 100644 index 61a518c..0000000 --- a/app/views/newsgroups/index.html.haml +++ /dev/null @@ -1,30 +0,0 @@ - - -.links - = link_to 'Ajouter un groupe', new_newsgroup_path, :class => "lien" if has_permission?('adherent.add') - - - -%h1 Liste des groupes - -%table.admin_table - %thead - %tr - %th{:style=>"width:80%;"} Nom du groupe - %th{:style=>"width:20%;"} - %tbody - -@newsgroups.each do |newsgroup| - %tr - %td=h newsgroup.name - - - %td.link-column - =link = link_to( 'Editer', edit_newsgroup_path(newsgroup),:class => "lien" ) if has_permission?('adherent.edit') - =link = link_to('Supprimer', newsgroup, :confirm => 'Êtes-vous sure de supprimer le groupe ?', :method => :delete, :class => "lien") if has_permission?('adherent.delete') - - - -%br - - - diff --git a/app/views/newsgroups/show.html.erb b/app/views/newsgroups/show.html.erb deleted file mode 100644 index 06c16f2..0000000 --- a/app/views/newsgroups/show.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -

- Name: - <%=h @newsgroup.name %> -

- -

- Description: - <%=h @newsgroup.description %> -

- - -<%= link_to 'Edit', edit_newsgroup_path(@newsgroup) %> | -<%= link_to 'Back', newsgroups_path %> \ No newline at end of file diff --git a/app/views/newsmailer/mail.html.haml b/app/views/newsmailer/mail.html.haml deleted file mode 100755 index d085234..0000000 --- a/app/views/newsmailer/mail.html.haml +++ /dev/null @@ -1,2 +0,0 @@ - -= @content diff --git a/app/views/newsmailer/newsletter.html.haml b/app/views/newsmailer/newsletter.html.haml deleted file mode 100755 index ab6c1e7..0000000 --- a/app/views/newsmailer/newsletter.html.haml +++ /dev/null @@ -1 +0,0 @@ -= @content \ No newline at end of file diff --git a/app/views/note_files/_note_file.html.haml b/app/views/note_files/_note_file.html.haml deleted file mode 100644 index 3ba68bd..0000000 --- a/app/views/note_files/_note_file.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -.note_file#note_file{:id => note_file.id} - -ext = File.extname(note_file.file.path)[1..-1] - %div{:style => "display:inline-block;text-align:center;width:30px;"}=image_tag "admin/file_types/"+ext+".png", :class => "icon" - =l note_file.created_at, :format => :short - =note_file.name - =link_to "supprimer", note_file_path(note_file), :remote => true, :method => :delete, :confirm => "Voulez-vous vraiment supprimer ce fichier ?" - =link_to "voir", note_file_path(note_file), :target => "_blank" - =link_to "télécharger", note_file_path(note_file, :download => true) - \ No newline at end of file diff --git a/app/views/note_files/edit.html.haml b/app/views/note_files/edit.html.haml deleted file mode 100644 index 6b6ac6d..0000000 --- a/app/views/note_files/edit.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h1 Editing note_file - -= render 'form' - -= link_to 'Show', @note_file -\| -= link_to 'Back', note_files_path diff --git a/app/views/note_files/index.html.haml b/app/views/note_files/index.html.haml deleted file mode 100644 index 425e37f..0000000 --- a/app/views/note_files/index.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -%h1 Listing note_files - -%table - %tr - %th File - %th Name - %th Slug - %th Description - %th - %th - %th - - - @note_files.each do |note_file| - %tr - %td= note_file.file - %td= note_file.name - %td= note_file.slug - %td= note_file.description - %td= link_to 'Show', note_file - %td= link_to 'Edit', edit_note_file_path(note_file) - %td= link_to 'Destroy', note_file, :confirm => 'Are you sure?', :method => :delete - -%br - -= link_to 'New Note file', new_note_file_path diff --git a/app/views/note_files/new.html.haml b/app/views/note_files/new.html.haml deleted file mode 100644 index c615f48..0000000 --- a/app/views/note_files/new.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -%h1 New note_file - -= render 'form' - -= link_to 'Back', note_files_path diff --git a/app/views/notes/edit.html.haml b/app/views/notes/edit.html.haml deleted file mode 100644 index eac8177..0000000 --- a/app/views/notes/edit.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -%h1 Editing note - -= render 'form' - -= link_to 'Show', @note -\| -= link_to 'Back', notes_path diff --git a/app/views/notes/index.html.haml b/app/views/notes/index.html.haml deleted file mode 100644 index 4318b27..0000000 --- a/app/views/notes/index.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -%h1 Listing notes - -%table - %tr - %th Subject - %th Message - %th User - %th - %th - %th - - - @notes.each do |note| - %tr - %td= note.subject - %td= note.message - %td= note.user - %td= link_to 'Show', note - %td= link_to 'Edit', edit_note_path(note) - %td= link_to 'Destroy', note, :confirm => 'Are you sure?', :method => :delete - -%br - -= link_to 'New Note', new_note_path diff --git a/app/views/sheets/_sheet.html.haml b/app/views/sheets/_sheet.html.haml deleted file mode 100644 index a7de94f..0000000 --- a/app/views/sheets/_sheet.html.haml +++ /dev/null @@ -1,24 +0,0 @@ -%tr#sheet_line{:id => sheet.id} - %td.hidden-phone - =sheet.sheet_number - -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 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/edit.js.erb b/app/views/sheets/edit.js.erb deleted file mode 100644 index 32d71bc..0000000 --- a/app/views/sheets/edit.js.erb +++ /dev/null @@ -1,3 +0,0 @@ -$('#sheet_show').remove(); -$('body').append("<%= escape_javascript(render(:template => "sheets/edit.html.haml")); %>"); -$("body").css("overflow", "hidden"); \ No newline at end of file diff --git a/app/views/sheets/new.js.erb b/app/views/sheets/new.js.erb deleted file mode 100644 index 56b9e3c..0000000 --- a/app/views/sheets/new.js.erb +++ /dev/null @@ -1,3 +0,0 @@ -$('#sheet_show').remove(); -$('body').append("<%= escape_javascript(render(:template => "sheets/new.html.haml")); %>"); -$("body").css("overflow", "hidden"); \ No newline at end of file diff --git a/app/views/sheets/show.js.erb b/app/views/sheets/show.js.erb deleted file mode 100644 index cf6425a..0000000 --- a/app/views/sheets/show.js.erb +++ /dev/null @@ -1,3 +0,0 @@ -$('#sheet_show').remove(); -$('body').append("<%= escape_javascript(render(:template => "sheets/show.html.haml")); %>"); -$("body").css("overflow", "hidden"); \ No newline at end of file diff --git a/app/views/topics/_show.html.haml b/app/views/topics/_show.html.haml deleted file mode 100644 index 40e3869..0000000 --- a/app/views/topics/_show.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -.topic_links - = link_to 'Modifier', edit_topic_path(@topic), :remote => true - = link_to 'Suprimer', topic_path(@topic), :remote => true, :method => :delete, :confirm => "Voulez-vous vraiment supprimer ce topic, et tout son contenu ?" - - - -%h1.topic_title= @topic.title -%p - Lancé par - = @topic.admin.username - -#notes=render @topic.notes -=link_to "Ajouter une note", new_note_path(:topic_id => @topic), :remote => true, :id => "add_note" - -#note_form_place diff --git a/app/views/topics/_topic.haml b/app/views/topics/_topic.haml deleted file mode 100644 index 1b1e11b..0000000 --- a/app/views/topics/_topic.haml +++ /dev/null @@ -1 +0,0 @@ -= link_to topic.title, topic, :class => "topic_line", :remote => true, :id => "topic_line_#{topic.id}" diff --git a/app/views/topics/index.html.haml b/app/views/topics/index.html.haml deleted file mode 100644 index 85e22fd..0000000 --- a/app/views/topics/index.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -#topic_app_index - - - #left - = link_to '+ ajouter un topic', new_topic_path, :remote => true, :id => "add_topic" - - #topics=render @topics - - - - - - #topic_show - \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 2950c98..252216a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,19 +1,48 @@ # -*- encoding : utf-8 -*- Survey::Application.routes.draw do + devise_for :admins, :controllers => {:sessions => "admins/sessions", :passwords => "admins/passwords"} + match 'plaquettes/:slug.:f' => 'plaquettes#show', :as => :plaquette, :f => "html" get "forum_user/index" + + #admin namespace :admin do root :to => "dashboard#index" + resources :admins resources :survey_types resources :petitions resources :tiny_urls + #note files + resources :note_files + resources :notes + resources :topics + + #sheets + resources :sheets do + collection do + get 'stats' + get 'recus' + put 'index' + end + end + resources :newsgroups + resources :donates + resources :sheet_years + resources :people do + member do + get 'principal' + end + end + end + + #forum namespace :forum do root :to => "forums#show", :id => 1 resources :forum_topics @@ -34,11 +63,7 @@ Survey::Application.routes.draw do end - resources :note_files - - resources :notes - - resources :topics + resources :newsletters do member do @@ -49,32 +74,8 @@ Survey::Application.routes.draw do end end - resources :newsgroups - - resources :donates - - resources :sheet_years - - resources :people do - member do - get 'principal' - - end - - end - - resources :sheets do - collection do - get 'stats' - get 'recus' - put 'index' - - end - - end - - devise_for :admins, :controllers => {:sessions => "admins/sessions", :passwords => "admins/passwords"} + match 'u/:id' => 'tiny_urls#show', :as => :tiny_url @@ -104,60 +105,7 @@ Survey::Application.routes.draw do end - # The priority is based upon order of creation: - # first created -> highest priority. - - # Sample of regular route: - # match 'products/:id' => 'catalog#view' - # Keep in mind you can assign values other than :controller and :action - - # Sample of named route: - # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase - # This route can be invoked with purchase_url(:id => product.id) - - # Sample resource route (maps HTTP verbs to controller actions automatically): - # resources :products - - # Sample resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Sample resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Sample resource route with more complex sub-resources - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', :on => :collection - # end - # end - - # Sample resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end - - # You can have the root of your site routed with "root" - # just remember to delete public/index.html. root :to => 'admin/dashboard#index' - # See how all your routes lay out with "rake routes" - - # This is a legacy wild controller route that's not recommended for RESTful applications. - # Note: This route will make all actions in every controller accessible via GET requests. - # match ':controller(/:action(/:id))(.:format)' + end