diff --git a/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_co_author_relations_controller.rb b/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_co_author_relations_controller.rb new file mode 100644 index 00000000..bfc09055 --- /dev/null +++ b/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_co_author_relations_controller.rb @@ -0,0 +1,63 @@ +class Panel::PersonalConference::Desktop::ConferenceCoAuthorRelationsController < ApplicationController + def index + @conference_co_author_relations = ConferenceCoAuthorRelation.all + new + + respond_to do |format| + format.html {render layout: false } + end + end + + def edit + @conference_co_author_relation = ConferenceCoAuthorRelation.find(params[:id]) + respond_to do |format| + format.html { render :layout => false} + end + end + + def new + @conference_co_author_relation = ConferenceCoAuthorRelation.new + end + + def create + @conference_co_author_relation = ConferenceCoAuthorRelation.new(params[:conference_co_author_relation]) + @conference_co_author_relations = ConferenceCoAuthorRelation.all + + if @conference_co_author_relation.save + newv = render_to_string partial: "show_form", object: @conference_co_author_relations + render json: {success: true, msg: "New Relation successfully saved!", newvalue: newv}.to_json + else + error_msg = @conference_co_author_relation.errors.full_messages.join("
") + render json: {success: false, msg: error_msg}.to_json + end + end + + def update + @conference_co_author_relation = ConferenceCoAuthorRelation.find(params[:id]) + if @conference_co_author_relation.update_attributes(params[:conference_co_author_relation]) + @conference_co_author_relations = ConferenceCoAuthorRelation.all + newv = render_to_string partial: "show_form", object: @conference_co_author_relations + render json: {success: true, msg: "New Relation successfully updated!", newvalue: newv}.to_json + else + error_msg = @conference_co_author.errors.full_messages.join("
") + render json: {success: false, msg: error_msg}.to_json + end + end + + def destroy + @conference_co_author_relation = ConferenceCoAuthorRelation.find(params[:id]) + @conference_co_author_relation.destroy + reset_co_author_relation + + render :json => {success: true, msg: "deleted successfully!"} + end + + private + + def reset_co_author_relation + co_author = ConferenceCoAuthor.where(co_author_relations_id: @co_author_relation.id) + co_author.map do |c| + c.update_attributes(co_author_relations_id: nil) + end + end +end diff --git a/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_co_authors_controller.rb b/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_co_authors_controller.rb new file mode 100644 index 00000000..f371b7e7 --- /dev/null +++ b/vendor/built_in_modules/personal_conference/app/controllers/panel/personal_conference/desktop/conference_co_authors_controller.rb @@ -0,0 +1,59 @@ +class Panel::PersonalConference::Desktop::ConferenceCoAuthorsController < ApplicationController + def index + nils, not_nils = ConferenceCoAuthor.where(name_id: current_user.id)\ + .asc(:co_author).partition{|p| p.email.nil?} + @conference_co_authors = not_nils + nils + @conference_co_author_relations = ConferenceCoAuthorRelation.all + + respond_to do |format| + format.html { render :layout => false} + end + end + + def new + @conference_co_author = ConferenceCoAuthor.new + @conference_co_author_relations = ConferenceCoAuthorRelation.all + + respond_to do |format| + format.html { render :layout => false} + end + end + + def edit + @conference_co_author = ConferenceCoAuthor.find(params[:id]) + @conference_co_author_relations = ConferenceCoAuthorRelation.all + respond_to do |format| + format.html { render :layout => false} + end + end + + def create + @conference_co_author = ConferenceCoAuthor.new(params[:conference_co_author]) + @conference_co_author.name_id= current_user.id + + if @conference_co_author.save + render json: {success:true, msg: t('create.sucess.co_author')}.to_json + else + error_msg = @conference_co_author.errors.full_messages.join("
") + render json: {success: false, msg: error_msg}.to_json + end + end + + def update + @conference_co_author = ConferenceCoAuthor.find(params[:id]) + + if @conference_co_author.update_attributes(params[:co_author]) + render json: {success:true, msg: t('update.sucess.co_author')}.to_json + else + error_msg = @conference_co_author.errors.full_messages.join("
") + render json: {success: false, msg: error_msg}.to_json + end + end + + def destroy + @conference_co_author = ConferenceCoAuthor.find(params[:id]) + @conference_co_author.destroy + + render :json => {success: true, msg: "Co-author deleted successfully!"} + end +end diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/_form.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/_form.html.erb new file mode 100644 index 00000000..d6f16b23 --- /dev/null +++ b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/_form.html.erb @@ -0,0 +1,11 @@ +<%= f.text_field :relation %> + +<%= f.submit "Save", class: "ini_input hp hh2 thmtxt thmc2", style: "margin-left: 10px;" %> +<% if not @conference_co_author_relation.new_record? %> + <%= submit_tag "Cancel", :type => "button", class: "bt-cancel-type ini_input hp hh2 thmtxt" %> +<% end %> diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/_new.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/_new.html.erb new file mode 100644 index 00000000..42c5a8a8 --- /dev/null +++ b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/_new.html.erb @@ -0,0 +1,3 @@ +<%= form_for(@conference_co_author_relation, url: panel_personal_conference_desktop_conference_co_author_relations_path, html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationForm"} ) do |f| %> + <%= render partial: 'form' , locals: {:f => f}%> +<% end %> diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/_show_form.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/_show_form.html.erb new file mode 100644 index 00000000..72566f1a --- /dev/null +++ b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/_show_form.html.erb @@ -0,0 +1,17 @@ +<% @conference_co_author_relations.each_with_index do |conference_co_author_relation,i| %> + <% if ( i % 6 ) == 0 %> +
+ +
+ <% end %> +<% end %> diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/edit.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/edit.html.erb new file mode 100644 index 00000000..3f40e44a --- /dev/null +++ b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/edit.html.erb @@ -0,0 +1,3 @@ +<%= form_for(@conference_co_author_relation, url: panel_personal_conference_desktop_conference_co_author_relation_path(@conference_co_author_relation), html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationEditForm"} ) do |f| %> + <%= render partial: 'form' , locals: {:f => f}%> +<% end %> diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/index.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/index.html.erb new file mode 100644 index 00000000..d8b4451a --- /dev/null +++ b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_author_relations/index.html.erb @@ -0,0 +1,22 @@ +
+
+
+
Create
+
+
    +
  • <%= render 'new' %>
  • +
+
+
+ <%= submit_tag "Back", :type => "button", class: "bt-cancel fn_btn ini_input hp hh2 thmtxt" %> +
+
+ +
+
+
+
+ <%= render :partial => 'show_form'%> +
+
+
diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_authors/_form.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_authors/_form.html.erb new file mode 100644 index 00000000..0df7a876 --- /dev/null +++ b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_authors/_form.html.erb @@ -0,0 +1,35 @@ +
+
+ <%= f.submit "Save", name: "commit", value: "Save", class: "fn_btn ini_input hp hh2 thmc2 thmtxt" %> + <%= submit_tag "Cancel", :type => "button", class: "bt-cancel fn_btn ini_input hp hh2 thmtxt" %> +
+
+
+ +
diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_authors/edit.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_authors/edit.html.erb new file mode 100644 index 00000000..6d53c335 --- /dev/null +++ b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_authors/edit.html.erb @@ -0,0 +1,3 @@ +<%= form_for @conference_co_author, html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"coAuthorformCallback"} , url: panel_personal_conference_desktop_conference_co_author_path(@conference_co_author) do |f| %> + <%= render partial: 'form', locals: {:f => f} %> +<% end %> diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_authors/index.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_authors/index.html.erb new file mode 100644 index 00000000..bc1e6bca --- /dev/null +++ b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_authors/index.html.erb @@ -0,0 +1,34 @@ +
+
+ <%= link_to "New Co-Author", new_panel_personal_conference_desktop_conference_co_author_path, :class=>"bt-co-author fn_btn hp hh2 thmc2 thmtxt", "ajax-remote"=>"get" %> + <%= link_to "New Type", panel_personal_conference_desktop_conference_co_author_relations_path, :class=>"bt-new-type fn_btn hp hh2 thmc2 thmtxt", "ajax-remote"=>"get" %> +
+
+
+
+
+
+ <% @conference_co_authors.each_with_index do |co_author,i| %> + <% if ( i % 4 ) == 0 %> +
+
    + <% end %> +
  • +
      +
    • <%= co_author.co_author %>
    • +
    • +
    • <%= @conference_co_author_relations.find(co_author.conference_co_author_relations_id).relation unless co_author.conference_co_author_relations_id.nil?%>
    • +
    +
    + <%= link_to 'Edit', edit_panel_personal_conference_desktop_conference_co_author_path(co_author), :class => "bt-edit admbg2 admtxt", "ajax-remote"=>"get" %> + <%= link_to 'Destroy', panel_personal_conference_desktop_conference_co_author_path(co_author), "ajax-remote"=>"delete", "confirm-message"=>'Are you sure?', "callback-method"=>"paperDelete", :class=>"bt-delete admbg2 admtxt" %> +
    +
  • + <% if ( i % 4 ) == 3 %> +
+
+ <% end %> + <% end %> +
+
+
diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_authors/new.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_authors/new.html.erb new file mode 100644 index 00000000..14e5a8b5 --- /dev/null +++ b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_authors/new.html.erb @@ -0,0 +1,3 @@ +<%= form_for @conference_co_author, html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"conferenceCoAuthorformCallback"} , url: panel_personal_conference_desktop_conference_co_authors_path do |f| %> + <%= render partial: 'form', locals: {:f => f} %> +<% end %> diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_authors/show.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_co_authors/show.html.erb new file mode 100644 index 00000000..e69de29b diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_window.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_window.html.erb index 00289e32..303aa092 100644 --- a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_window.html.erb +++ b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_window.html.erb @@ -16,7 +16,7 @@
  • List
  • Add/Edit
  • Conference
  • -
  • Co-Authors
  • +
  • Co-Authors
  • Tags & Keywords
  • Analysis
  • Import
  • diff --git a/vendor/built_in_modules/personal_conference/config/routes.rb b/vendor/built_in_modules/personal_conference/config/routes.rb index 37515409..bf6466b7 100644 --- a/vendor/built_in_modules/personal_conference/config/routes.rb +++ b/vendor/built_in_modules/personal_conference/config/routes.rb @@ -5,7 +5,9 @@ Rails.application.routes.draw do namespace :desktop do match 'conference_window' => 'conference_windows#conference_window' match 'conference_type' => 'conference_pages#conference_type' - resources :conference_pages + resources :conference_pages, except: :show + resources :conference_co_authors, except: :show + resources :conference_co_author_relations, except: :show end namespace :back_end do match 'writing_conference_setting' => "writing_conferences#writing_conference_setting" ,:as => :writing_conference_setting diff --git a/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_co_author_relations_controller.rb b/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_co_author_relations_controller.rb index 735098d0..22e42f22 100644 --- a/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_co_author_relations_controller.rb +++ b/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_co_author_relations_controller.rb @@ -22,7 +22,6 @@ class Panel::PersonalJournal::Desktop::JournalCoAuthorRelationsController < Appl def create @journal_co_author_relation = JournalCoAuthorRelation.new(params[:journal_co_author_relation]) @journal_co_author_relations = JournalCoAuthorRelation.all - binding.pry if @journal_co_author_relation.save newv = render_to_string partial: "show_form", object: @journal_co_author_relations