Merge commit 'e429aa9425e9648a94a1dd7bb5cea15af7ba854a' into sidebar_config
Conflicts: app/views/layouts/_side_bar_content.html.erb config/locales/zh_tw.yml config/mongoid.yml vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb vendor/built_in_modules/announcement/init.rb
This commit is contained in:
commit
ca290f3519
262 files changed
+7692
-2403
No files matched your search
Binary file not shown.
@@ -101,7 +101,6 @@ class Admin::DesignsController < OrbitBackendController
|
||||
def create
|
||||
@design = Design.new(params[:design])
|
||||
if @design.save
|
||||
flash[:notice] = "Successfully created design and tasks."
|
||||
redirect_to admin_designs_url
|
||||
else
|
||||
render :action => 'new'
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
class Admin::ModuleStoreController < ApplicationController
|
||||
|
||||
layout "new_admin"
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
end
|
||||
@@ -3,7 +3,7 @@ class Admin::PurchasesController < ApplicationController
|
||||
require "uri"
|
||||
require 'zip/zip'
|
||||
|
||||
layout "admin"
|
||||
layout "new_admin"
|
||||
|
||||
def index
|
||||
@purchases = Purchase.all.entries
|
||||
@@ -112,7 +112,7 @@ class Admin::PurchasesController < ApplicationController
|
||||
|
||||
log = Logger.new(STDOUT)
|
||||
log.level = Logger::WARN
|
||||
log.warn("App unzip procress is finished,please restart the server to apply effect")
|
||||
log.warn(t(:unzip_app))
|
||||
|
||||
#TODO Perform touch tmp/restart to restart in production env
|
||||
end
|
||||
@@ -159,7 +159,7 @@ class Admin::PurchasesController < ApplicationController
|
||||
|
||||
log = Logger.new(STDOUT)
|
||||
log.level = Logger::WARN
|
||||
log.warn("App unzip procress is finished,please restart the server to apply effect")
|
||||
log.warn(t(:unzip_app))
|
||||
}
|
||||
|
||||
temp_file.close
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
class Admin::TemplateStoreController < ApplicationController
|
||||
|
||||
layout "new_admin"
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,78 +0,0 @@
|
||||
class Admin::UsersController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
|
||||
|
||||
def index
|
||||
@users = User.all.entries
|
||||
end
|
||||
|
||||
def show
|
||||
@user = User.find(params[:id])
|
||||
get_info_and_roles
|
||||
end
|
||||
|
||||
def new
|
||||
@user = User.new
|
||||
get_info_and_roles
|
||||
end
|
||||
|
||||
def create
|
||||
puts params.to_yaml
|
||||
@user = User.new(params[:user])
|
||||
if @user.save
|
||||
flash[:notice] = t('create.success.user')
|
||||
redirect_to :action => :index
|
||||
else
|
||||
render :action => :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@user = User.find(params[:id])
|
||||
get_info_and_roles
|
||||
end
|
||||
|
||||
def update
|
||||
@user = User.find(params[:id])
|
||||
|
||||
# Update changes to the avatar
|
||||
@user.remove_avatar! if params[:file]
|
||||
@user.avatar = params[:file] if params[:file]
|
||||
|
||||
if @user.id.to_s.eql?(session['warden.user.user.key'][1].to_s) && @user.admin != params[:user][:admin].to_i.to_b
|
||||
flash.now[:error] = t(:cant_revoke_self_admin)
|
||||
end
|
||||
if !flash[:error] && @user.update_attributes(params[:user])
|
||||
flash[:notice] = t('update.success.user')
|
||||
redirect_to :action => :index
|
||||
else
|
||||
get_info_and_roles
|
||||
render :action => :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if params[:id].eql?(session['warden.user.user.key'][1].to_s)
|
||||
flash[:error] = t(:cant_delete_self)
|
||||
else
|
||||
@user = User.find(params[:id])
|
||||
@user.destroy
|
||||
end
|
||||
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def get_info_and_roles
|
||||
@infos = Info.excludes('disabled' => true)
|
||||
@roles = Role.excludes('disabled' => true)
|
||||
end
|
||||
|
||||
def set_attribute
|
||||
@class = 'users'
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,33 @@
|
||||
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
|
||||
newv = render_to_string :partial=>"show_form", :object=>@new_relation
|
||||
render json: {success:true, msg: "New Relation successfully saved!","newvalue"=>newv}.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
|
||||
@@ -1,10 +1,10 @@
|
||||
class Desktop::CoAuthorsController < ApplicationController
|
||||
def index
|
||||
@co_authors = CoAuthor.where(name_id: current_user.id)
|
||||
@co_author_relations = CoAuthorRelation.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :layout => false}
|
||||
format.json { render json: @co_authors }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,6 +19,7 @@ class Desktop::CoAuthorsController < ApplicationController
|
||||
|
||||
def new
|
||||
@co_author = CoAuthor.new
|
||||
@co_author_relations = CoAuthorRelation.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :layout => false}
|
||||
@@ -27,6 +28,7 @@ class Desktop::CoAuthorsController < ApplicationController
|
||||
|
||||
def edit
|
||||
@co_author = CoAuthor.find(params[:id])
|
||||
@co_author_relations = CoAuthorRelation.all
|
||||
respond_to do |format|
|
||||
format.html { render :layout => false}
|
||||
end
|
||||
@@ -37,9 +39,10 @@ class Desktop::CoAuthorsController < ApplicationController
|
||||
@co_author.name_id= current_user.id
|
||||
|
||||
if @co_author.save
|
||||
render json: {success:true, msg: "Co-author successfully saved!"}.to_json
|
||||
render json: {success:true, msg: t('create.sucess.co_author')}.to_json
|
||||
else
|
||||
render json: {success: false, msg: @co_author.errors.full_messages}.to_json
|
||||
error_msg = @co_author.errors.full_messages.join("<br />")
|
||||
render json: {success: false, msg: error_msg}.to_json
|
||||
end
|
||||
end
|
||||
|
||||
@@ -47,33 +50,17 @@ class Desktop::CoAuthorsController < ApplicationController
|
||||
@co_author = CoAuthor.find(params[:id])
|
||||
|
||||
if @co_author.update_attributes(params[:co_author])
|
||||
render json: {success:true, msg: "Co-author successfully update!"}.to_json
|
||||
render json: {success:true, msg: t('update.sucess.co_author')}.to_json
|
||||
else
|
||||
render json: {success: false, msg: @co_author.errors.full_messages}.to_json
|
||||
error_msg = @co_author.errors.full_messages.join("<br />")
|
||||
render json: {success: false, msg: error_msg}.to_json
|
||||
end
|
||||
end
|
||||
|
||||
def delete
|
||||
def destroy
|
||||
@co_author = CoAuthor.find(params[:id])
|
||||
@co_author.destroy
|
||||
|
||||
#respond_to do |format|
|
||||
# format.html { redirect_to desktop_co_authors_url, :layout => false }
|
||||
# format.json { head :no_content }
|
||||
#end
|
||||
end
|
||||
|
||||
def get_co_authors_json
|
||||
@co_authors = CoAuthor.where(name_id: current_user.id)
|
||||
data = Array.new
|
||||
|
||||
@co_authors.each do |co_author|
|
||||
data << {
|
||||
author: co_author.co_author,
|
||||
email: co_author.email,
|
||||
type: co_author.type
|
||||
}
|
||||
end
|
||||
render json: JSON.pretty_generate(data)
|
||||
render :json => {success: true, msg: "Co-author deleted successfully!"}
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
class Desktop::JournalListsController < ApplicationController
|
||||
|
||||
def index
|
||||
level_types = JournalLevelType.all
|
||||
all_journal_lists = WritingJournal.where(create_user_id: current_user.id)
|
||||
all_journal_lists = all_journal_lists.map do |j|
|
||||
[ j.journal_title,
|
||||
j.journal_level_type_ids.map do |type|
|
||||
level_types.find(type).title
|
||||
end.join(",")
|
||||
].join(" -- ")
|
||||
end
|
||||
|
||||
@journal_lists = all_journal_lists.uniq
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :layout => false}
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -18,6 +18,10 @@ class Desktop::JournalPagesController < ApplicationController
|
||||
@level_types = JournalLevelType.all
|
||||
@author_types = JournalAuthorType.all
|
||||
@paper_types= JournalPaperType.all
|
||||
@co_author_candidate =
|
||||
CoAuthor.where(name_id: current_user.id).map{|c|c.co_author}
|
||||
@journal_candidate =
|
||||
WritingJournal.where(create_user_id: current_user.id).map{|j|j.journal_title}.uniq
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render :layout => false}
|
||||
@@ -26,7 +30,7 @@ class Desktop::JournalPagesController < ApplicationController
|
||||
end
|
||||
|
||||
def edit
|
||||
@writing_journal= WritingJournal.find(params[:id])
|
||||
@writing_journal = WritingJournal.find(params[:id])
|
||||
@level_types = JournalLevelType.all
|
||||
@author_types = JournalAuthorType.all
|
||||
@paper_types= JournalPaperType.all
|
||||
@@ -40,40 +44,28 @@ class Desktop::JournalPagesController < ApplicationController
|
||||
@writing_journal = WritingJournal.new(params[:writing_journal])
|
||||
|
||||
if @writing_journal.save
|
||||
render json: {success: true, msg: "Paper successfully saved!"}.to_json
|
||||
render json: {success: true, msg: t('create.success.paper')}.to_json
|
||||
else
|
||||
render json: {success: false, msg: @writing_journal.errors.full_messages}.to_json
|
||||
error_msg = @writing_journal.errors.full_messages.join("<br />")
|
||||
render json: {success: false, msg: error_msg}.to_json
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
params[:writing_journal][:update_user_id] = current_user.id
|
||||
@writing_journal= WritingJournal.find(params[:id])
|
||||
respond_to do |format|
|
||||
if @writing_journal.update_attributes(params[:writing_journal])
|
||||
render json: {success: true, msg: "Paper successfully saved!"}.to_json
|
||||
else
|
||||
render json: {success: false, msg: @writing_journal.errors.full_messages}.to_json
|
||||
end
|
||||
|
||||
if @writing_journal.update_attributes(params[:writing_journal])
|
||||
render json: {success: true, msg: t('update.success.paper')}.to_json
|
||||
else
|
||||
error_msg = @writing_journal.errors.full_messages.join("<br />")
|
||||
render json: {success: false, msg: error_msg}.to_json
|
||||
end
|
||||
end
|
||||
|
||||
def check_file_type file
|
||||
if not file.nil?
|
||||
file_type = MIME::Types.type_for(file).first.to_s.split("/")[1]
|
||||
|
||||
# case file_type
|
||||
# when "jpg", "jpeg"
|
||||
# type = "jpg"
|
||||
# when "text", "txt"
|
||||
# type = "txt"
|
||||
# when "pdf"
|
||||
# type = "pdf"
|
||||
# when "png"
|
||||
# type = "png"
|
||||
# else "readme"
|
||||
# end
|
||||
|
||||
file_type = "/assets/ft-icons/#{file_type}/#{file_type}-48_32.png"
|
||||
else
|
||||
file_type = ""
|
||||
@@ -83,7 +75,7 @@ class Desktop::JournalPagesController < ApplicationController
|
||||
def destroy
|
||||
@writing_journal = WritingJournal.find(params[:id])
|
||||
@writing_journal.destroy
|
||||
render :json => {success: true, msg: "Paper deleted successfully!"}
|
||||
render :json => {success: true, msg: t('delete.success.paper')}
|
||||
end
|
||||
|
||||
def get_journals_json
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
class Desktop::RegistrationsController < Devise::RegistrationsController
|
||||
def update
|
||||
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
|
||||
|
||||
if resource.update_with_password(params[resource_name])
|
||||
set_flash_message :notice, :updated if is_navigational_format?
|
||||
sign_in resource_name, resource, :bypass => true
|
||||
render json: {success:true, msg: "Password successfully update!"}.to_json
|
||||
else
|
||||
clean_up_passwords(resource)
|
||||
error_msg = resource.errors.full_messages.join("<br />")
|
||||
render :json => {success: false, msg: error_msg}.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@ class PagesController < ApplicationController
|
||||
impressionist(@item)
|
||||
render_page
|
||||
else
|
||||
render :text => 'You need a home page'
|
||||
render :text => t(:need_home)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user