<%= l(:label_bidding_user_studentcode)%>:
diff --git a/app/views/news/_project_news.html.erb b/app/views/news/_project_news.html.erb
index 79217f1fe..526c7a1a5 100644
--- a/app/views/news/_project_news.html.erb
+++ b/app/views/news/_project_news.html.erb
@@ -82,11 +82,11 @@
:html => {:id => 'news-form', :multipart => true} do |f| %>
<%= render :partial => 'news/form', :locals => {:f => f} %>
<%#= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %>
- <%= link_to l(:button_create), "#", :onclick => 'submitNews();',:onmouseover => 'submitFocus(this);', :class => 'whiteButton m3p10' %>
+ <%= link_to l(:button_create), "#", :onclick => 'submitNews();',:onmouseover => 'submitFocus(this);', :class => 'ButtonColor m3p10' %>
|
<%#= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
- <%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'whiteButton m3p10' %>
+ <%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'ButtonColor m3p10' %>
<% end if @project %>
diff --git a/app/views/poll/_edit_MC.html.erb b/app/views/poll/_edit_MC.html.erb
index 066eafe0d..f89407247 100644
--- a/app/views/poll/_edit_MC.html.erb
+++ b/app/views/poll/_edit_MC.html.erb
@@ -39,8 +39,12 @@
diff --git a/app/views/poll/_edit_MCQ.html.erb b/app/views/poll/_edit_MCQ.html.erb
index 129f50e94..d6045f965 100644
--- a/app/views/poll/_edit_MCQ.html.erb
+++ b/app/views/poll/_edit_MCQ.html.erb
@@ -36,8 +36,12 @@
diff --git a/app/views/poll/_edit_head.html.erb b/app/views/poll/_edit_head.html.erb
index ed90a5ef8..dfa5b5cfc 100644
--- a/app/views/poll/_edit_head.html.erb
+++ b/app/views/poll/_edit_head.html.erb
@@ -7,8 +7,12 @@
diff --git a/app/views/poll/_edit_mulit.html.erb b/app/views/poll/_edit_mulit.html.erb
index d498169f4..5c694ff05 100644
--- a/app/views/poll/_edit_mulit.html.erb
+++ b/app/views/poll/_edit_mulit.html.erb
@@ -20,8 +20,12 @@
diff --git a/app/views/poll/_edit_single.html.erb b/app/views/poll/_edit_single.html.erb
index 2c2d41e0f..5aff29984 100644
--- a/app/views/poll/_edit_single.html.erb
+++ b/app/views/poll/_edit_single.html.erb
@@ -16,8 +16,12 @@
diff --git a/app/views/poll/_new_MC.html.erb b/app/views/poll/_new_MC.html.erb
index a7f9e441b..294c058f8 100644
--- a/app/views/poll/_new_MC.html.erb
+++ b/app/views/poll/_new_MC.html.erb
@@ -34,8 +34,12 @@
diff --git a/app/views/poll/_new_MCQ.html.erb b/app/views/poll/_new_MCQ.html.erb
index 027a1c1f6..1478f9918 100644
--- a/app/views/poll/_new_MCQ.html.erb
+++ b/app/views/poll/_new_MCQ.html.erb
@@ -33,8 +33,12 @@
diff --git a/app/views/poll/_new_mulit.html.erb b/app/views/poll/_new_mulit.html.erb
index 02f7a71a7..23ffb3d64 100644
--- a/app/views/poll/_new_mulit.html.erb
+++ b/app/views/poll/_new_mulit.html.erb
@@ -13,8 +13,12 @@
diff --git a/app/views/poll/_new_single.html.erb b/app/views/poll/_new_single.html.erb
index ffc525546..4ee185070 100644
--- a/app/views/poll/_new_single.html.erb
+++ b/app/views/poll/_new_single.html.erb
@@ -8,8 +8,12 @@
diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb
index 1bf6b3716..fdf534405 100644
--- a/app/views/poll/_poll.html.erb
+++ b/app/views/poll/_poll.html.erb
@@ -22,7 +22,7 @@
<% end %>
<%if @is_teacher%>
- <% if poll.polls_status == 1 %>
+ <% if poll.polls_status == 1 || poll.polls_status == 3 %>
统计结果
<% elsif poll.polls_status == 2%>
@@ -31,38 +31,61 @@
<% end%>
<% end%>
-
- <%if @is_teacher %>
+
+<%if @is_teacher %>
<% if poll.polls_status == 1 %>
- 发布问卷
+
+
+ 发布问卷
+
+
<% elsif poll.polls_status == 2%>
- 取消发布
+
+
+ 取消发布
+
+
+ <% else%>
+
+ 发布问卷
+
<% end%>
- <% end%>
-
+<% end%>
+
<% if @is_teacher %>
<%= link_to(l(:button_delete), poll,
- method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml20 mr10") %>
+ method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml15 mr10") %>
<% end%>
-
- <% if @is_teacher%>
- <% if poll.polls_status == 1 %>
- <%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml20"%>
- <% elsif poll.polls_status == 2%>
- 编辑
- <% end%>
+
+<% if @is_teacher%>
+ <% if poll.polls_status == 1 %>
+
+ <%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml15"%>
+
+ <% else%>
+
+ 编辑
+
<% end%>
-
-
-
-
-
-
-
-
+<% end%>
+
+<% if @is_teacher%>
+ <% if poll.polls_status == 2 %>
+
+ 关闭
+
+ <% else %>
+
+ 关闭
+
+ <% end%>
+
+<% end %>
+
+
<%= format_time poll.created_at%>
\ No newline at end of file
diff --git a/app/views/poll/close_poll.js.erb b/app/views/poll/close_poll.js.erb
new file mode 100644
index 000000000..222ea7976
--- /dev/null
+++ b/app/views/poll/close_poll.js.erb
@@ -0,0 +1,2 @@
+$("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>");
+alert("关闭成功");
\ No newline at end of file
diff --git a/app/views/poll/index.html.erb b/app/views/poll/index.html.erb
index 29a5ec51f..3db4d7caa 100644
--- a/app/views/poll/index.html.erb
+++ b/app/views/poll/index.html.erb
@@ -56,6 +56,30 @@
$('#ajax-modal').parent().addClass("popbox_polls");
}
}
+
+ function close_poll(poll_id)
+ {
+ $('#ajax-modal').html("" +
+ " " +
+ " " +
+ " 问卷关闭后学生将不能继续提交问卷, 是否确定关闭该问卷? " +
+ " " +
+ " " +
+ " " +
+ " " +
+ " ");
+ showModal('ajax-modal', '310px');
+ $('#ajax-modal').css('height','120px');
+ $('#ajax-modal').siblings().remove();
+ $('#ajax-modal').before("" +
+ "");
+ $('#ajax-modal').parent().removeClass("alert_praise");
+ $('#ajax-modal').parent().css("top","").css("left","");
+ $('#ajax-modal').parent().addClass("popbox_polls");
+ }
diff --git a/app/views/projects/_join_project.html.erb b/app/views/projects/_join_project.html.erb
index d30ec73e1..fdc60904d 100644
--- a/app/views/projects/_join_project.html.erb
+++ b/app/views/projects/_join_project.html.erb
@@ -67,7 +67,7 @@
项目ID是所在项目网址中显示的序号
- <%= l(:label_new_join) %>
+ <%= l(:label_apply_project) %>
<%= l(:button_cancel)%>
diff --git a/config/initializers/autoreload_grape.rb b/config/initializers/autoreload_grape.rb
new file mode 100644
index 000000000..ceffb9425
--- /dev/null
+++ b/config/initializers/autoreload_grape.rb
@@ -0,0 +1,26 @@
+if Rails.env.development?
+ lib_ruby_files = Dir.glob(File.join("app/api/**", "*.rb"))
+ lib_reloader ||= ActiveSupport::FileUpdateChecker.new(lib_ruby_files) do
+ # lib_ruby_files.each do |lib_file|
+ # puts "start require #{lib_file}"
+ # require_dependency(lib_file)
+ # end
+ #
+
+ # binding.pry
+ # if Object.const_defined?(:Mobile)
+ # Object.send(:remove_const, :Mobile)
+ # end
+ #
+ # $".delete_if {|s| s.include?('api/mobile') }
+ # require File.join(Rails.root,"app/api/mobile/api.rb")
+ Rails.application.reload_routes!
+ end
+
+ ActionDispatch::Callbacks.to_prepare do
+ lib_reloader.execute_if_updated
+ end
+
+end
+
+
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 38f33de22..972fd99a1 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -237,7 +237,7 @@ en:
mail_body_wiki_content_updated: "The '%{id}' wiki page has been updated by %{author}."
# edit by meng
- # emailer
+ # emailer translation
mail_issue_greetings: "Dear user , Greetings from Trustie"
mail_issue_footer: "Unsubscribe this message?"
mail_issue_title_userin: "in"
@@ -250,9 +250,14 @@ en:
mail_issue_reply: "Want reply"
#end
# modified by meng
+ # file_upload translation
label_file_upload: Resource files
label_file_upload_error_messages: "Upload error, please check your network environment, and refresh the page to upload."
button_confirm: Confirm
+ # shut down and restart course
+ label_course_closed: Close
+ label_course_reopen: Reopen
+ label_course_closed_tips: "Are you sure you want to reopen the course?"
# end
field_name: Name
field_description: Description
@@ -541,7 +546,7 @@ en:
project_module_calendar: Calendar
project_module_gantt: Gantt
- #edit by meng
+ # edit by meng
lable_hot_course: Hot projects
lable_hot_projects: Active courses
lable_user_active: User movements
@@ -559,10 +564,10 @@ en:
label_project_grade: Score
label_user_for_project_grade: Score
label_relation_files: Select an existing resource
-
+ # Personal signature tips
label_my_brief_introduction: How are feeling today? Leave your footprints ~
- label_submit: Submit
-
+ label_submit: Submit
+ # create course and course info
label_tags_course_name: Course Title
label_new_course_password: Password
label_new_course_description: Description
@@ -572,39 +577,32 @@ en:
label_teacher_list: Teacher list
label_student_list: Student list
label_export_excel: Export list
-
label_course_organizers: Institute
label_poll: Questionnaire
-
+ # homework info and anonymous info
field_open_anonymous_evaluation: Use anonymous mutual-evaluation
- field_evaluation_num: Number of anonymous works sent to each student
-
+ field_evaluation_num: Number of anonymous works sent to each student
label_edit_homework: Update homework
- label_homework_list: Work list
-
+ label_homework_list: Work list
label_teacher_score: Teacher's score
label_time: Commit time
label_student_score: Student's score
label_without_score: No evaluated
label_homework_description: Description
label_responses: Messages
-
lable_has_commit_homework: You have submitted your work
-
-
label_user_create_project_homework: created the task
label_commit_limit: Expired but can submit your work
-
+ # steam the student
label_current_group: Current group
-
+ # DTS Test tool
project_module_dts: DTS Test tool
label_module_share: DTS Test tool
field_dts_test: DTS Test tool
-
+ # Feedback module
label_technical_support: Support :
label_feedback: Feedback
#end
-
label_user: User
label_user_plural: Users
label_user_new: New user
@@ -638,7 +636,7 @@ en:
label_project_latest: Latest projects
label_issue: Issue
label_issue_new: New issue
- label_issue_plural: Issues
+ label_issue_plural: Issues Tracking
label_issue_view_all: View all issues
label_issues_by: "Issues by %{value}"
label_issue_added: Issue added
@@ -691,7 +689,10 @@ en:
label_my_page_block: My page block
label_administration: Administration
label_login: Login
- label_logout: Sign out
+ # edit by meng
+ # Logout
+ label_logout: Logout
+ # end
label_help: Help
label_reported_issues: Reported issues
label_assigned_to_me_issues: Issues assigned to me
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 115bc815b..d058a6c1b 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -252,7 +252,7 @@ zh:
mail_body_wiki_content_updated: "'%{id}' wiki页面已由 %{author} 更新。"
# edit by meng
- # emailer
+ # 邮件中文格式
mail_issue_greetings: "亲爱的Trustie用户,您好!"
mail_issue_footer: "退订该邮件!"
mail_issue_title_userin: "在"
@@ -263,11 +263,16 @@ zh:
mail_issue_from_project: "项目问题跟踪"
mail_issue_attachments: "附件:"
mail_issue_reply: "我要回复"
- #end
+ # end
# modified by meng
+ # 课程资源上传
label_file_upload: 资源文件
label_file_upload_error_messages: "上传出现错误,请您检查您的网络环境,并刷新页面重新上传。"
button_confirm: 确认
+ # 教师权限课程关闭和重启
+ label_course_closed: 关闭
+ label_course_reload: 重开
+ label_course_closed_tips: "确定要%{desc}课程?"
# end
field_name: 名称
#added by huang
@@ -591,7 +596,7 @@ zh:
label_project_latest: 最近的项目
label_issue: 问题
label_issue_new: 新建问题
- label_issue_plural: 缺陷
+ label_issue_plural: 问题跟踪
label_issue_view_all: 查看所有问题
label_issues_by: "按 %{value} 分组显示问题"
label_issue_added: 问题已添加
@@ -1034,7 +1039,7 @@ zh:
label_user_activities_other: 该用户暂无任何动态!
label_project_overview: "概述"
label_project_tool: "项目工具集"
- label_project_issues: "缺陷"
+ label_project_issues: "问题"
label_project_newother: "查看其他评论"
label_project_newshare: "分享了"
label_project_notice: "发布了通知:"
diff --git a/config/routes.rb b/config/routes.rb
index 65498e4ec..122481d38 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -26,10 +26,10 @@
# Example: :via => :get ====> :via => :get
RedmineApp::Application.routes.draw do
-
-
#match '/contests/:id/contestnotifications', :controller => 'contestnotifications', :action => 'index'
+ mount Mobile::API => '/api'
+
resources :homework_users
resources :no_uses
delete 'no_uses', :to => 'no_uses#delete'
@@ -67,6 +67,7 @@ RedmineApp::Application.routes.draw do
get 'publish_poll'
get 'republish_poll'
get 'poll_result'
+ get 'close_poll'
end
collection do
delete 'delete_poll_question'
diff --git a/db/migrate/20141127015431_create_api_keys.rb b/db/migrate/20141127015431_create_api_keys.rb
new file mode 100644
index 000000000..81a232848
--- /dev/null
+++ b/db/migrate/20141127015431_create_api_keys.rb
@@ -0,0 +1,14 @@
+class CreateApiKeys < ActiveRecord::Migration
+ def change
+ create_table :api_keys do |t|
+ t.string :access_token
+ t.datetime :expires_at
+ t.integer :user_id
+ t.boolean :active, default: true
+
+ t.timestamps
+ end
+ add_index :api_keys, :user_id
+ add_index :api_keys, :access_token
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 20c74ba1e..74ba6d652 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -12,6 +12,7 @@
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150123020615) do
+>>>>>>> szzh
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -23,6 +24,18 @@ ActiveRecord::Schema.define(:version => 20150123020615) do
add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type"
add_index "activities", ["user_id"], :name => "index_activities_on_user_id"
+ create_table "api_keys", :force => true do |t|
+ t.string "access_token"
+ t.datetime "expires_at"
+ t.integer "user_id"
+ t.boolean "active", :default => true
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token"
+ add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id"
+
create_table "applied_projects", :force => true do |t|
t.integer "project_id", :null => false
t.integer "user_id", :null => false
diff --git a/public/Trustie_Beta1.0.0_201412310917.apk b/public/Trustie_Beta1.0.0_201412310917.apk
new file mode 100644
index 000000000..0218f66a0
Binary files /dev/null and b/public/Trustie_Beta1.0.0_201412310917.apk differ
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 54e2a17aa..db57596bc 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -2916,4 +2916,5 @@ input[class~='m3p10'], .m3p10 {
height: 20px;
display: inline-block;
color: #ffffff;
+ cursor:pointer;
}
\ No newline at end of file
diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css
index 370a3c515..f0d670a1d 100644
--- a/public/stylesheets/polls.css
+++ b/public/stylesheets/polls.css
@@ -31,7 +31,7 @@ a.polls_title{ font-weight:bold; color:#3e6d8e;max-width: 300px;white-space: now
a.pollsbtn{ display:block; width:66px; height:22px; text-align:center; border:1px solid #64bdd9; color:#64bdd9;}
a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;}
.polls_date{ color:#666666;}
-.polls_de{ color:#6883b6;}
+.polls_de{ color:#6883b6;padding-left: 5px;}
/****翻页***/
ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
ul.wlist li{float: left;}
@@ -143,5 +143,5 @@ a.btn_pu{ border:1px solid #3cb761; color:#3cb761; }
a:hover.btn_pu{ background:#3cb761;}
.pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; }
.polls_title_w { width:330px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
-.polls_de_grey{ color:#b1b1b1;}
+.polls_de_grey{ color:#b1b1b1;padding-left: 5px;}
.ml5{ margin-left:5px;}
diff --git a/test/mobile/auth_test.rb b/test/mobile/auth_test.rb
new file mode 100644
index 000000000..afc5719e8
--- /dev/null
+++ b/test/mobile/auth_test.rb
@@ -0,0 +1,24 @@
+require File.expand_path('../../test_helper.rb',__FILE__)
+
+class AuthTest < ActionDispatch::IntegrationTest
+ def setup
+ ApiKey.delete_all
+ end
+
+ test "login success when use correct password" do
+ post('/api/v1/auth/login.json', {login: 'guange', password: '123456'})
+ o = ActiveSupport::JSON.decode response.body
+ puts o
+ puts o["token"]
+ assert_not_nil o["token"]
+ end
+
+ test "login failure when incorrect password" do
+ post('/api/v1/auth/login.json', {login: 'guange', password: 'wrongpass'})
+ o = ActiveSupport::JSON.decode response.body
+ assert_nil o["token"]
+ assert_equal o["error"], 'Unauthorized.'
+ end
+end
+
+
diff --git a/test/mobile/users_test.rb b/test/mobile/users_test.rb
new file mode 100644
index 000000000..48b8010b4
--- /dev/null
+++ b/test/mobile/users_test.rb
@@ -0,0 +1,12 @@
+require File.expand_path('../../test_helper.rb',__FILE__)
+
+class UsersTest < ActionDispatch::IntegrationTest
+ test "register a user" do
+ end
+ test "get all users" do
+ get '/api/v1/users.json'
+ assert_response :success
+ end
+end
+
+
|