diff --git a/app/assets/javascripts/softapplications.js b/app/assets/javascripts/softapplications.js new file mode 100644 index 000000000..dee720fac --- /dev/null +++ b/app/assets/javascripts/softapplications.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/assets/stylesheets/softapplications.css b/app/assets/stylesheets/softapplications.css new file mode 100644 index 000000000..afad32db0 --- /dev/null +++ b/app/assets/stylesheets/softapplications.css @@ -0,0 +1,4 @@ +/* + Place all the styles related to the matching controller here. + They will automatically be included in application.css. +*/ diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb new file mode 100644 index 000000000..3bddec62c --- /dev/null +++ b/app/controllers/softapplications_controller.rb @@ -0,0 +1,83 @@ +class SoftapplicationsController < ApplicationController + # GET /softapplications + # GET /softapplications.json + def index + @softapplications = Softapplication.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @softapplications } + end + end + + # GET /softapplications/1 + # GET /softapplications/1.json + def show + @softapplication = Softapplication.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @softapplication } + end + end + + # GET /softapplications/new + # GET /softapplications/new.json + def new + @softapplication = Softapplication.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @softapplication } + end + end + + # GET /softapplications/1/edit + def edit + @softapplication = Softapplication.find(params[:id]) + end + + # POST /softapplications + # POST /softapplications.json + def create + @softapplication = Softapplication.new(params[:softapplication]) + + respond_to do |format| + if @softapplication.save + format.html { redirect_to @softapplication, notice: 'Softapplication was successfully created.' } + format.json { render json: @softapplication, status: :created, location: @softapplication } + else + format.html { render action: "new" } + format.json { render json: @softapplication.errors, status: :unprocessable_entity } + end + end + end + + # PUT /softapplications/1 + # PUT /softapplications/1.json + def update + @softapplication = Softapplication.find(params[:id]) + + respond_to do |format| + if @softapplication.update_attributes(params[:softapplication]) + format.html { redirect_to @softapplication, notice: 'Softapplication was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @softapplication.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /softapplications/1 + # DELETE /softapplications/1.json + def destroy + @softapplication = Softapplication.find(params[:id]) + @softapplication.destroy + + respond_to do |format| + format.html { redirect_to softapplications_url } + format.json { head :no_content } + end + end +end diff --git a/app/helpers/softapplications_helper.rb b/app/helpers/softapplications_helper.rb new file mode 100644 index 000000000..e3cb6410d --- /dev/null +++ b/app/helpers/softapplications_helper.rb @@ -0,0 +1,2 @@ +module SoftapplicationsHelper +end diff --git a/app/models/softapplication.rb b/app/models/softapplication.rb new file mode 100644 index 000000000..53440be81 --- /dev/null +++ b/app/models/softapplication.rb @@ -0,0 +1,3 @@ +class Softapplication < ActiveRecord::Base + attr_accessible :android_min_version_available, :app_type_id, :app_type_name, :description, :name, :user_id +end diff --git a/app/views/contests/_softapplication_list.html.erb b/app/views/contests/_softapplication_list.html.erb new file mode 100644 index 000000000..9a2576835 --- /dev/null +++ b/app/views/contests/_softapplication_list.html.erb @@ -0,0 +1,16 @@ + +<%= render_flash_messages %> + +
<%= l(:label_bidding_project) %> | + <% if User.current.logged? %> +
+
+
+ <%= link_to(l(:button_contesting_as_application), {:controller => 'softapplications', :action => 'new'}) %>
+
+ |
+ <% end %>
+
Name | +Description | +App type | +App type name | +Android min version available | +User | ++ | + | + |
---|---|---|---|---|---|---|---|---|
<%= softapplication.name %> | +<%= softapplication.description %> | +<%= softapplication.app_type_id %> | +<%= softapplication.app_type_name %> | +<%= softapplication.android_min_version_available %> | +<%= softapplication.user_id %> | +<%= link_to 'Show', softapplication %> | +<%= link_to 'Edit', edit_softapplication_path(softapplication) %> | +<%= link_to 'Destroy', softapplication, method: :delete, data: { confirm: 'Are you sure?' } %> | +
<%= notice %>
+ ++ Name: + <%= @softapplication.name %> +
+ ++ Description: + <%= @softapplication.description %> +
+ ++ App type: + <%= @softapplication.app_type_id %> +
+ ++ App type name: + <%= @softapplication.app_type_name %> +
+ ++ Android min version available: + <%= @softapplication.android_min_version_available %> +
+ ++ User: + <%= @softapplication.user_id %> +
+ + +<%= link_to 'Edit', edit_softapplication_path(@softapplication) %> | +<%= link_to 'Back', softapplications_path %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 448690b46..ffcfd1296 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1826,4 +1826,13 @@ zh: label_contest_application: 参赛应用 button_contesting_as_project: 我要参赛(新建项目) button_contesting_as_application: 我要参赛(发布应用) - + label_release_softapplication: 发布应用 + label_upload_softapplication_packets: 上传应用软件包 + label_upload_softapplication_photo: 上传产品截图 + label_upload_softapplication_photo_condition: 至少上传2张截图,至多4张;格式为gif/jpg/png, 尺寸480*800, 每张小于2M + label_softapplication_name: 应用名称 + label_softapplication_description: 应用简介 + label_softapplication_type: 应用分类 + label_softapplication_version_available: 适配版本 + label_softapplication_developer: 开发者 + label_softapplication_name_condition: 25个汉字以内(50个字符) diff --git a/db/migrate/20140404030103_create_softapplications.rb b/db/migrate/20140404030103_create_softapplications.rb new file mode 100644 index 000000000..f9094d9c9 --- /dev/null +++ b/db/migrate/20140404030103_create_softapplications.rb @@ -0,0 +1,14 @@ +class CreateSoftapplications < ActiveRecord::Migration + def change + create_table :softapplications do |t| + t.string :name + t.string :description + t.integer :app_type_id + t.string :app_type_name + t.string :android_min_version_available + t.integer :user_id + + t.timestamps + end + end +end diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index e60316841..514cb7685 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2693,4 +2693,12 @@ div.repos_explain{ margin-left: -220px; } - +/* new linchun compitition */ +.contest_underline{ + margin:1; + padding:1; + width:900px; + height:0.5px; + background-color:#aaa; + overflow:hidden +} diff --git a/test/fixtures/softapplications.yml b/test/fixtures/softapplications.yml new file mode 100644 index 000000000..0ab48299f --- /dev/null +++ b/test/fixtures/softapplications.yml @@ -0,0 +1,17 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + name: MyString + description: MyString + app_type_id: 1 + app_type_name: MyString + android_min_version_available: MyString + user_id: 1 + +two: + name: MyString + description: MyString + app_type_id: 1 + app_type_name: MyString + android_min_version_available: MyString + user_id: 1 diff --git a/test/functional/softapplications_controller_test.rb b/test/functional/softapplications_controller_test.rb new file mode 100644 index 000000000..8c5611cb9 --- /dev/null +++ b/test/functional/softapplications_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class SoftapplicationsControllerTest < ActionController::TestCase + setup do + @softapplication = softapplications(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:softapplications) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create softapplication" do + assert_difference('Softapplication.count') do + post :create, softapplication: { android_min_version_available: @softapplication.android_min_version_available, app_type_id: @softapplication.app_type_id, app_type_name: @softapplication.app_type_name, description: @softapplication.description, name: @softapplication.name, user_id: @softapplication.user_id } + end + + assert_redirected_to softapplication_path(assigns(:softapplication)) + end + + test "should show softapplication" do + get :show, id: @softapplication + assert_response :success + end + + test "should get edit" do + get :edit, id: @softapplication + assert_response :success + end + + test "should update softapplication" do + put :update, id: @softapplication, softapplication: { android_min_version_available: @softapplication.android_min_version_available, app_type_id: @softapplication.app_type_id, app_type_name: @softapplication.app_type_name, description: @softapplication.description, name: @softapplication.name, user_id: @softapplication.user_id } + assert_redirected_to softapplication_path(assigns(:softapplication)) + end + + test "should destroy softapplication" do + assert_difference('Softapplication.count', -1) do + delete :destroy, id: @softapplication + end + + assert_redirected_to softapplications_path + end +end diff --git a/test/unit/helpers/softapplications_helper_test.rb b/test/unit/helpers/softapplications_helper_test.rb new file mode 100644 index 000000000..ad8173602 --- /dev/null +++ b/test/unit/helpers/softapplications_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class SoftapplicationsHelperTest < ActionView::TestCase +end diff --git a/test/unit/softapplication_test.rb b/test/unit/softapplication_test.rb new file mode 100644 index 000000000..b3872eec5 --- /dev/null +++ b/test/unit/softapplication_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SoftapplicationTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end