can add relation between co-author

This commit is contained in:
Rueshyna authored and chris committed 2012-12-04 00:31:06 +08:00
1 parent 5dabfe9319
commit 7822ffc33d
18 files changed
+350 -77

No files matched your search

@@ -0,0 +1,32 @@
class Desktop::CoAuthorRelationsController < ApplicationController
def index
@co_author_relations = CoAuthorRelation.all
new
respond_to do |format|
format.html {render layout: false }
end
end
def new
@new_relation = CoAuthorRelation.new
end
def create
@new_relation = CoAuthorRelation.new(params[:co_author_relation])
if @new_relation.save
render json: {success:true, msg: "New Relation successfully saved!"}.to_json
else
error_msg = @new_relation.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def destroy
@co_author_relation = CoAuthorRelation.find(params[:id])
@co_author_relation.destroy
render :json => {success: true, msg: "deleted successfully!"}
end
end
@@ -4,7 +4,6 @@ class Desktop::CoAuthorsController < ApplicationController
respond_to do |format|
format.html { render :layout => false}
format.json { render json: @co_authors }
end
end
@@ -1,6 +1,5 @@
class Desktop::JournalListsController < ApplicationController
# GET /desktop/journal_lists
# GET /desktop/journal_lists.json
def index
level_types = JournalLevelType.all
all_journal_lists = WritingJournal.where(create_user_id: current_user.id)
@@ -18,76 +17,4 @@ class Desktop::JournalListsController < ApplicationController
format.html { render :layout => false}
end
end
=begin
# GET /desktop/journal_lists/1
# GET /desktop/journal_lists/1.json
def show
@desktop_journal_list = Desktop::JournalList.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @desktop_journal_list }
end
end
# GET /desktop/journal_lists/new
# GET /desktop/journal_lists/new.json
def new
@desktop_journal_list = Desktop::JournalList.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @desktop_journal_list }
end
end
# GET /desktop/journal_lists/1/edit
def edit
@desktop_journal_list = Desktop::JournalList.find(params[:id])
end
# POST /desktop/journal_lists
# POST /desktop/journal_lists.json
def create
@desktop_journal_list = Desktop::JournalList.new(params[:desktop_journal_list])
respond_to do |format|
if @desktop_journal_list.save
format.html { redirect_to @desktop_journal_list, notice: 'Journal list was successfully created.' }
format.json { render json: @desktop_journal_list, status: :created, location: @desktop_journal_list }
else
format.html { render action: "new" }
format.json { render json: @desktop_journal_list.errors, status: :unprocessable_entity }
end
end
end
# PUT /desktop/journal_lists/1
# PUT /desktop/journal_lists/1.json
def update
@desktop_journal_list = Desktop::JournalList.find(params[:id])
respond_to do |format|
if @desktop_journal_list.update_attributes(params[:desktop_journal_list])
format.html { redirect_to @desktop_journal_list, notice: 'Journal list was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @desktop_journal_list.errors, status: :unprocessable_entity }
end
end
end
# DELETE /desktop/journal_lists/1
# DELETE /desktop/journal_lists/1.json
def destroy
@desktop_journal_list = Desktop::JournalList.find(params[:id])
@desktop_journal_list.destroy
respond_to do |format|
format.html { redirect_to desktop_journal_lists_url }
format.json { head :ok }
end
end
=end
end