Skip to content

Commit

Permalink
feat: add note for pkg info
Browse files Browse the repository at this point in the history
  • Loading branch information
tinyc-z committed Dec 5, 2018
1 parent 288c1b3 commit e10a75e
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
18 changes: 10 additions & 8 deletions app/assets/stylesheets/pkgs/show.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,13 @@
float: right;
}
}
.info{
color: #9B9B9B;
font-size: 13px;
max-width: 100%;
word-break:break-all;
}
}
}
.history{
.history,.features{
box-sizing: border-box;
padding: 0 12px;
width: 100%;
padding-bottom: 12px;
.wrap{
background-color: #F8F8F8;
border-radius: 4px;
Expand All @@ -119,7 +114,14 @@
}
}
}

.extend-info,.features{
.info{
color: #9B9B9B;
font-size: 13px;
max-width: 100%;
word-break:break-all;
}
}
.footer{
text-align: center;
a{
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/pkgs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def api_create

plat = Plat.find params[:plat_id]

pkg = Pkg.new({file:params[:file], user_id:user.id, plat_id:plat.id, file_nick_name:params[:file_nick_name]})
pkg = Pkg.new({file:params[:file], user_id:user.id, plat_id:plat.id, file_nick_name:params[:file_nick_name],features:params[:features]})
pkg.app_id = pkg.plat.app_id

unless params[:file_nick_name].present?
Expand All @@ -96,6 +96,6 @@ def set_plat

# # Never trust parameters from the scary internet, only allow the white list through.
def pkg_params
params.require(:pkg).permit(:file,:plat_id,:file_nick_name)
params.require(:pkg).permit(:file,:plat_id,:file_nick_name,:features)
end
end
5 changes: 5 additions & 0 deletions app/views/pkgs/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
<label for="file_nick_name">重命名</label>
<%= f.text_field :file_nick_name, class:"form-control", placeholder:"不填会直接使用文件名" %>
</div>

<div class="form-group">
<label for="features">变更描述</label>
<%= f.text_area :features, class:"form-control", placeholder:"描述该包修改细节" %>
</div>

<%=f.submit "上传", class:"btn btn-primary ui-plat"%>
<%end%>
Expand Down
14 changes: 14 additions & 0 deletions app/views/pkgs/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@
</div>

<% cache [@pkg,'v1'] do %>

<% if @pkg.features.present? %>
<div class="features">
<div class="wrap">
<h3 class="title">变更描述:</h3>
<p class="info">
<%@pkg.features.split("\n").each do |line|%>
<%=line%><br/>
<%end%>
</p>
</div>
</div>
<% end %>

<% @ext_info = @pkg.ext_info %>
<% if @ext_info.present? %>
<div class="extend-info">
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/api_token.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<hr>
<h4>USEGAE:</h4>
curl --form plat_id=<span class="alert-danger">34</span> --form file_nick_name=<span class="alert-danger">file_nick_name(可选)</span> --form token=<span class="alert-danger"><%=current_user.api_token%></span> --form file=<span class="alert-danger">@/xx/xx.ipa</span> <%="#{Settings.PROTOCOL}#{Settings.HOST}"%>/api/pkgs
curl --form plat_id=<span class="alert-danger">34</span> --form file_nick_name=<span class="alert-danger">file_nick_name(可选)</span> --form token=<span class="alert-danger"><%=current_user.api_token%></span> --form features=<span class="alert-danger">features(可选)</span> --form file=<span class="alert-danger">@/xx/xx.ipa</span> <%="#{Settings.PROTOCOL}#{Settings.HOST}"%>/api/pkgs

</div>
5 changes: 5 additions & 0 deletions db/migrate/20181205180629_add_features_to_pkg.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddFeaturesToPkg < ActiveRecord::Migration[5.1]
def change
add_column :pkgs, :features, :string
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20171102093445) do
ActiveRecord::Schema.define(version: 20181205180629) do

create_table "apps", force: :cascade do |t|
t.string "name"
Expand Down Expand Up @@ -46,6 +46,7 @@
t.integer "user_id"
t.datetime "deleted_at"
t.string "file_nick_name"
t.string "features"
t.index ["deleted_at"], name: "index_pkgs_on_deleted_at"
end

Expand Down

0 comments on commit e10a75e

Please sign in to comment.