memcached_alan
huang 10 years ago
commit 003b088091

@ -1,4 +1,5 @@
source 'http://rubygems.org'
#source 'http://ruby.taobao.com'
#source 'http://ruby.sdutlinux.org/'
unless RUBY_PLATFORM =~ /w32/
@ -23,6 +24,7 @@ gem 'ruby-ole'
#gem 'email_verifier', path: 'lib/email_verifier'
gem 'rufus-scheduler'
#gem 'dalli', path: 'lib/dalli-2.7.2'
gem 'rails_kindeditor'
group :development do
gem 'grape-swagger'
#gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'

@ -0,0 +1,34 @@
class DiscussDemosController < ApplicationController
def index
@discuss_demo_list = DiscussDemo.where("body is not null").order("created_at desc").page(params[:page] || 1).per(10)
end
def new
@discuss_demo = DiscussDemo.create
@discuss_demo.save!
@discuss_demo
end
def create
end
def update
@discuss_demo = DiscussDemo.find(params[:id])
@discuss_demo.update_attributes(:title => params[:discuss_demo][:title],:body => params[:discuss_demo][:body])
redirect_to :controller=> 'discuss_demos',:action => 'show',:id => params[:id]
end
def delete
end
def destroy
DiscussDemo.delete_all(["id = ?",params[:id]])
redirect_to :controller=> 'discuss_demos',:action => 'index'
end
def show
@discuss_demo = DiscussDemo.find(params[:id])
end
end

@ -162,7 +162,7 @@ class IssuesController < ApplicationController
respond_to do |format|
format.html {
render_attachment_warning_if_needed(@issue)
flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("#{@issue.source_from}", issue_path(@issue), :title => @issue.subject))
flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("#{@issue.subject}", issue_path(@issue), :title => @issue.subject))
#flash[:notice] = l(:notice_issue_successful_create, :id => view_context.link_to("##{@issue.id}", issue_path(@issue), :title => @issue.subject))
if params[:continue]
attrs = {:tracker_id => @issue.tracker, :parent_issue_id => @issue.parent_issue_id}.reject {|k,v| v.nil?}

@ -355,7 +355,7 @@ module CoursesHelper
# 课程time+term简写2014.春/2014.秋)国际化输出
def get_course_term course
strterm = course.try(:term).to_s
if !(User.current.language == 'zh')
if !(User.current.language == 'zh'||User.current.language == '')
strterm == '春季学期' ? strterm = 'spring term' : strterm = 'autumn term'
str = ( course.try(:time).to_s << '.' << strterm )
str[0..-6]
@ -369,7 +369,7 @@ module CoursesHelper
# 课程term春季学期/秋季学期)国际化输出
def get_course_term_locales course
str = course.try(:term).to_s
if !(User.current.language == 'zh')
if !(User.current.language == 'zh'||User.current.language == '')
str == '春季学期' ? str = ' ' + 'spring term' : str = ' ' + 'autumn term'
end
return str

@ -0,0 +1,2 @@
module DiscussDemosHelper
end

@ -0,0 +1,4 @@
class DiscussDemo < ActiveRecord::Base
attr_accessible :title, :body
has_many_kindeditor_assets :attachments, :dependent => :destroy
end

@ -0,0 +1,15 @@
class Kindeditor::Asset < ActiveRecord::Base
self.table_name = 'kindeditor_assets'
mount_uploader :asset, Kindeditor::AssetUploader
validates_presence_of :asset
before_save :update_asset_attributes
attr_accessible :asset
private
def update_asset_attributes
if asset.present? && asset_changed?
self.file_size = asset.file.size
self.file_type = asset.file.content_type
end
end
end

@ -0,0 +1,3 @@
class Kindeditor::File < Kindeditor::Asset
mount_uploader :asset, Kindeditor::FileUploader
end

@ -0,0 +1,3 @@
class Kindeditor::Flash < Kindeditor::Asset
mount_uploader :asset, Kindeditor::FlashUploader
end

@ -0,0 +1,3 @@
class Kindeditor::Image < Kindeditor::Asset
mount_uploader :asset, Kindeditor::ImageUploader
end

@ -0,0 +1,3 @@
class Kindeditor::Media < Kindeditor::Asset
mount_uploader :asset, Kindeditor::MediaUploader
end

@ -1,5 +1,22 @@
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
<%= if attachment.id.nil?
#待补充代码
else
link_to('&nbsp;'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
end
%>
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span id="attachments_p<%= i %>" class="attachment">
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
@ -17,6 +34,7 @@
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% end %>
</span>
<script type='text/javascript'>

@ -0,0 +1,25 @@
<h1 style="">文章列表</h1>
<div>
<table border="1px solid !important" >
<% @discuss_demo_list.each do |e| %>
<tr align="left" height="20">
<td width="30%" ><%= truncate(e.title,:length => 50) %></td>
<td align="center" width="60%">
<%= truncate(e.body,:length => 50) %> &nbsp;
</td>
<td style=" margin-right: 1" width="10%">
<%= link_to '查看文章',{:controller => 'discuss_demos',:action => 'show',:id=>e.id} %>
</td>
<td>
&nbsp;&nbsp;
<%= link_to '删除文章',discuss_demo_path(e.id), :method => :delete,:confirm => l(:text_are_you_sure) %>
</td>
</tr>
<tr height="20"></tr>
<tr height="20"></tr>
<% end %>
</table>
<% paginate @discuss_demo_list %>
<%= link_to '新建文章',new_discuss_demo_path %>
</div>

@ -0,0 +1,7 @@
<%= javascript_include_tag src='/assets/kindeditor/kindeditor' %>
<h1>新建文章</h1>
<%= form_for @discuss_demo,:url => {:controller => 'discuss_demos',:action => "show",:id =>@discuss_demo.id, :method => :put} do |f| %>
<%= f.text_field :title %>
<%= f.kindeditor :body ,:owner_id => @discuss_demo.id%>
<%= f.submit :value=> '提交' %>
<% end %>

@ -0,0 +1,3 @@
<h1><%= @discuss_demo.title %></h1>
<%= textAreailizable @discuss_demo.body %>
<%=link_to "返回首页",discuss_demos_path %>

@ -1,4 +1,4 @@
<%= error_messages_for @news %>
.<%= error_messages_for @news %>
<div class="add_frame_header" >
<%= @project ? l(:label_news_new) : l(:bale_news_notice) %>
</div>

@ -72,9 +72,9 @@
:html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
<%#= submit_tag l(:button_save) %>
<%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'whiteButton m3p10' %>
<%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'ButtonColor m3p10' %>
<%#= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'whiteButton m3p10' %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'ButtonColor m3p10'%>
<% end %>
<div id="preview" class="wiki"></div>
</div>

@ -0,0 +1,19 @@
RailsKindeditor.setup do |config|
# Specify the subfolders in public directory.
# You can customize it , eg: config.upload_dir = 'this/is/my/folder'
config.upload_dir = 'files/uploads'
# Allowed file types for upload.
config.upload_image_ext = %w[gif jpg jpeg png bmp]
config.upload_flash_ext = %w[swf flv]
config.upload_media_ext = %w[swf flv mp3 wav wma wmv mid avi mpg asf rm rmvb]
config.upload_file_ext = %w[doc docx xls xlsx ppt htm html txt zip rar gz bz2]
# Porcess upload image size
# eg: 1600x1600 => 800x800
# 1600x800 => 800x400
# 400x400 => 400x400 # No Change
# config.image_resize_to_limit = [800, 800]
end

@ -329,10 +329,7 @@ en:
permission_notificationcomment_contestnotifications: Add the notice of contest comments
permission_upload_attachments: Uploading resource
project_module_issue_tracking: Issue tracking
project_module_time_tracking: Time tracking
project_module_files: Files
project_module_boards: Forums
# edit by meng
lable_hot_course: Hot Courses
label_course_join_student: Join a course
@ -896,7 +893,7 @@ en:
text_issues_destroy_confirmation: 'Are you sure you want to delete the selected issue(s)?'
text_issues_destroy_descendants_confirmation: "This will also delete %{count} subtask(s)."
text_time_entries_destroy_confirmation: 'Are you sure you want to delete the selected time entr(y/ies)?'
text_select_project_modules: 'Select modules to enable for this project:'
text_default_administrator_account_changed: Default administrator account changed
text_file_repository_writable: Attachments directory writable
text_plugin_assets_writable: Plugin assets directory writable

@ -66,6 +66,20 @@ en:
label_expend_information: More Information
#
# 项目托管平台
#
# 问题跟踪
#
#
# 项目托管平台
#
# 项目讨论区
#
#
# 项目托管平台
#
@ -77,6 +91,14 @@ en:
label_repository_plural: Repositories
enumeration_activities: Activities
text_select_project_modules: "Select modules to enable for this project:"
project_module_issue_tracking: Issue tracking
project_module_time_tracking: Time tracking
project_module_course: 课程
project_module_files: Files
project_module_boards: Forums
#
# 项目托管平台
#

@ -79,7 +79,10 @@ zh:
text_select_project_modules: '请选择此项目可以使用的模块:'
project_module_issue_tracking: 问题跟踪
project_moule_boards_show: 项目论坛
project_module_time_tracking: 时间跟踪
project_module_course: 课程
#
# 项目托管平台

@ -350,17 +350,9 @@ zh:
permission_contest_attachments_download: 竞赛附件下载
permission_upload_attachments: 资源上传
project_module_issue_tracking: 问题跟踪
project_moule_boards_show: 项目论坛
project_module_time_tracking: 时间跟踪
project_module_course: 课程
label_user: 用户
label_user_plural: 用户列表
@ -1276,7 +1268,6 @@ zh:
label_followers: 关注
label_delete_confirm: 确认删除?
label_more_tags: 更多
label_tags_bid: 需求名称
label_tags_course_name: 课程名称
label_tags_bid_description: 需求描述

@ -27,6 +27,9 @@
RedmineApp::Application.routes.draw do
resources :discuss_demos
#match '/discuss_demos/new',:to => 'discuss_demo#create',:via =>[:post]
#match '/discuss_demo/show',:to => 'discuss_demo#show'
mount Mobile::API => '/api'
resources :homework_users

@ -0,0 +1,9 @@
class CreateDiscussDemos < ActiveRecord::Migration
def change
create_table :discuss_demos do |t|
t.string :title
t.text :body
t.timestamps
end
end
end

@ -0,0 +1,17 @@
class CreateKindeditorAssets < ActiveRecord::Migration
def self.up
create_table :kindeditor_assets do |t|
t.string :asset
t.integer :file_size
t.string :file_type
t.integer :owner_id
t.string :asset_type # list by kindeditor: image, file, media, flash
t.timestamps
end
end
def self.down
drop_table :kindeditor_assets
end
end

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save