• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamephpguicwindows翻訳pythonomegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

Voice data server for navigation voice changer app.


Commit MetaInfo

Revision5705bd43fa99d835e4e4452b4925ec69d1dc48f6 (tree)
Time2016-09-29 22:58:18
AuthorHMML <hmml3939@gmai...>
CommiterHMML

Log Message

Tune upload error handling, update paperclip.

Change Summary

Incremental Difference

--- a/Gemfile
+++ b/Gemfile
@@ -59,7 +59,7 @@ gem 'client_side_validations'
5959 gem 'client_side_validations-simple_form'
6060 gem 'responders'
6161 gem 'rspec-rails', group: [:development, :test]
62-gem 'paperclip', '3.5.0'
62+gem 'paperclip'
6363 gem 'rubyzip', '< 1.0.0', require: 'zip/zip'
6464 gem 'rails_admin'
6565 group :develpment do
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -121,6 +121,7 @@ GEM
121121 mime-types (3.1)
122122 mime-types-data (~> 3.2015)
123123 mime-types-data (3.2016.0521)
124+ mimemagic (0.3.2)
124125 minitest (5.9.1)
125126 multi_json (1.12.1)
126127 mysql2 (0.4.4)
@@ -130,11 +131,12 @@ GEM
130131 net-ssh (3.2.0)
131132 nokogiri (1.6.8)
132133 pkg-config (~> 1.1.7)
133- paperclip (3.5.0)
134- activemodel (>= 3.0.0)
135- activesupport (>= 3.0.0)
136- cocaine (~> 0.5.0)
134+ paperclip (5.1.0)
135+ activemodel (>= 4.2.0)
136+ activesupport (>= 4.2.0)
137+ cocaine (~> 0.5.5)
137138 mime-types
139+ mimemagic (~> 0.3.0)
138140 pkg-config (1.1.7)
139141 quiet_assets (1.1.0)
140142 railties (>= 3.1, < 5.0)
@@ -271,7 +273,7 @@ DEPENDENCIES
271273 jquery-rails
272274 kaminari
273275 mysql2
274- paperclip (= 3.5.0)
276+ paperclip
275277 quiet_assets
276278 rails (= 4.2.7.1)
277279 rails-i18n
--- a/app/controllers/navi_voices_controller.rb
+++ b/app/controllers/navi_voices_controller.rb
@@ -56,6 +56,7 @@ class NaviVoicesController < ApplicationController
5656 logger.info "Delete NaviVoice ##{@navi_voice.id}, from #{request.remote_ip})"
5757 @navi_voice.destroy
5858 else
59+ flash[:error] = t 'delete_key_is_not_matched'
5960 @navi_voice.errors[:delete_key] << 'is not matched.'
6061 logger.info "Delete denied: Key validation failed for ##{@navi_voice.id}, from #{request.remote_ip}"
6162 end
--- a/app/models/navi_voice.rb
+++ b/app/models/navi_voice.rb
@@ -12,7 +12,9 @@ class NaviVoice < ActiveRecord::Base
1212 attr_accessor :raw_delete_key
1313 attr_accessor :tos_agree
1414
15- validates_attachment :archive, presence: true, size: {less_than: 5120.kilobytes}
15+ validates_attachment :archive, presence: true,
16+ size: {less_than: 5120.kilobytes},
17+ content_type: { content_type: %w(application/zip) }
1618 validates :archive, voice_archive: { on: :create }
1719 validates :title, presence: true, length: {maximum: 80}
1820 validates :description, length: {maximum: 280}
--- a/app/views/layouts/_messages.html.haml
+++ b/app/views/layouts/_messages.html.haml
@@ -1,5 +1,5 @@
11 - flash.each do |name, msg|
22 - if msg.is_a?(String)
3- %div{:class => "alert alert-#{name == :notice ? "success" : "danger"}"}
3+ %div{:class => "alert alert-#{name.to_s == 'notice' ? "success" : "danger"}"}
44 %a.close{"data-dismiss" => "alert"} &times;
55 = content_tag :div, msg, :id => "flash_#{name}"
--- a/app/views/layouts/_navigation.html.haml
+++ b/app/views/layouts/_navigation.html.haml
@@ -17,5 +17,5 @@
1717 = link_to t('navi.news'), news_index_path
1818 - if @headline
1919 %p.navbar-text.pull-right.headline
20- %span.glyphicon.glyphicon-exclamation-sign
20+ %span.icon-exclamation-sign &nbsp;
2121 = link_to "#{@headline.created_at.strftime('%m/%d')} #{@headline.title}", @headline, class: 'navbar-link'
--- a/app/views/navi_voices/_form.html.haml
+++ b/app/views/navi_voices/_form.html.haml
@@ -17,3 +17,8 @@
1717 = f.input :tos_agree, as: :boolean
1818 = next_arrow
1919 = f.button :submit, class: 'btn btn-primary btn-lg btn-block', id: 'btn-nv-submit'
20+
21+:coffee
22+ $('#new_navi_voice').on 'submit', ->
23+ $('#btn-nv-submit').val('#{t "uploading_wait"}').attr('disabled', 'disabled')
24+ return true
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -57,3 +57,5 @@ en:
5757 err_normalize: Failed on rate/channel normalization
5858
5959 site_title: NaviVoiceChanger
60+ delete_key_is_not_matched: Delete key is not matched.
61+ uploading_wait: Uploading, please wait...
\ No newline at end of file
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -77,3 +77,5 @@ ja:
7777 err_normalize: サンプルレート/チャネル数の変更に失敗しました
7878
7979 site_title: ナビボイスチェンジャー
80+ delete_key_is_not_matched: 削除キーが違います
81+ uploading_wait: アップロード中です...
\ No newline at end of file