Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第二周作業Artstore week2 #26

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp

config/settings.yml
config/database.yml
public/uploads
34 changes: 34 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,37 @@ gem 'spring', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]


#customize gem
#gem 'pry', '~> 0.10.0'
gem 'pry-rails'
gem 'pry-plus'
gem "simple_form", "3.1.0rc1"
gem 'bootstrap-sass', '~> 3.2.0.0'
#The bootstrap-sass-rails gem is deprecated starting with version 3.1.0.0.
#gem 'bootstrap-sass-rails', '~> 3.1.0.0'
gem 'will_paginate' , '~> 3.0'
gem 'will_paginate-bootstrap'
gem 'devise' , '~> 3.2'
gem 'carrierwave'
gem 'mini_magick', '~> 3.7.0'
gem 'cocoon', '~> 1.2.6'
gem 'settingslogic', '~> 2.0.9'
gem 'aasm', '~> 3.3.1'

# add for snipper
gem 'jquery-ui-rails', '~> 5.0.0'

group :developmet, :test do
gem 'guard-livereload'
gem 'annotate', '~> 2.6.5'
gem 'mysql2'
gem 'letter_opener', '~> 1.2.0'
gem 'roadie', '~> 3.0.0'
end






141 changes: 141 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
aasm (3.3.1)
actionmailer (4.1.0)
actionpack (= 4.1.0)
actionview (= 4.1.0)
Expand All @@ -27,33 +28,136 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
addressable (2.3.6)
annotate (2.6.5)
activerecord (>= 2.3.0)
rake (>= 0.8.7)
arel (5.0.1.20140414130214)
bcrypt (3.1.7)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bond (0.5.1)
bootstrap-sass (3.2.0.0)
sass (~> 3.2)
builder (3.2.2)
carrierwave (0.10.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
mime-types (>= 1.16)
celluloid (0.15.2)
timers (~> 1.1.0)
cocoon (1.2.6)
coderay (1.1.0)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.7.0)
columnize (0.8.9)
css_parser (1.3.5)
addressable
debug_inspector (0.0.2)
debugger (1.6.8)
columnize (>= 0.3.1)
debugger-linecache (~> 1.2.0)
debugger-ruby_core_source (~> 1.3.5)
debugger-linecache (1.2.0)
debugger-ruby_core_source (1.3.5)
devise (3.2.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
erubis (2.7.0)
eventmachine (1.0.3)
execjs (2.2.0)
ffi (1.9.3)
formatador (0.2.5)
guard (2.6.1)
formatador (>= 0.2.4)
listen (~> 2.7)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
guard-livereload (2.3.0)
em-websocket (~> 0.5)
guard (~> 2.0)
multi_json (~> 1.8)
hike (1.2.3)
http_parser.rb (0.6.0)
i18n (0.6.9)
interception (0.5)
jbuilder (2.0.8)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
jist (1.5.1)
json
jquery-rails (3.1.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (5.0.0)
railties (>= 3.2.16)
json (1.8.1)
launchy (2.4.2)
addressable (~> 2.3)
letter_opener (1.2.0)
launchy (~> 2.2)
listen (2.7.9)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.9)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.8.2)
mime-types (1.25.1)
mini_magick (3.7.0)
subexec (~> 0.2.1)
mini_portile (0.6.0)
minitest (5.3.4)
multi_json (1.10.1)
mysql2 (0.3.16)
nokogiri (1.6.3)
mini_portile (= 0.6.0)
orm_adapter (0.5.0)
polyglot (0.3.5)
pry (0.10.0)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-debugger (0.2.3)
debugger (~> 1.3)
pry (>= 0.9.10, < 0.11.0)
pry-doc (0.6.0)
pry (~> 0.9)
yard (~> 0.8)
pry-docmore (0.1.1)
pry
pry-doc
pry-plus (1.0.0)
bond
jist
pry-debugger
pry-doc
pry-docmore
pry-rescue
pry-stack_explorer
pry-rails (0.3.2)
pry (>= 0.9.10)
pry-rescue (1.4.1)
interception (>= 0.5)
pry
pry-stack_explorer (0.4.9.1)
binding_of_caller (>= 0.7)
pry (>= 0.9.11)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
Expand All @@ -73,8 +177,14 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.3.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rdoc (4.1.1)
json (~> 1.4)
roadie (3.0.0)
css_parser (~> 1.3.4)
nokogiri (~> 1.6.0)
sass (3.2.19)
sass-rails (4.0.3)
railties (>= 4.0.0, < 5.0)
Expand All @@ -84,6 +194,11 @@ GEM
sdoc (0.4.0)
json (~> 1.8)
rdoc (~> 4.0, < 5.0)
settingslogic (2.0.9)
simple_form (3.1.0.rc1)
actionpack (~> 4.0)
activemodel (~> 4.0)
slop (3.5.0)
spring (1.1.3)
sprockets (2.11.0)
hike (~> 1.2)
Expand All @@ -95,9 +210,11 @@ GEM
activesupport (>= 3.0)
sprockets (~> 2.8)
sqlite3 (1.3.9)
subexec (0.2.3)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
timers (1.1.0)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
Expand All @@ -108,18 +225,42 @@ GEM
uglifier (2.5.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
warden (1.2.3)
rack (>= 1.0)
will_paginate (3.0.7)
will_paginate-bootstrap (1.0.1)
will_paginate (>= 3.0.3)
yard (0.8.7.4)

PLATFORMS
ruby

DEPENDENCIES
aasm (~> 3.3.1)
annotate (~> 2.6.5)
bootstrap-sass (~> 3.2.0.0)
carrierwave
cocoon (~> 1.2.6)
coffee-rails (~> 4.0.0)
devise (~> 3.2)
guard-livereload
jbuilder (~> 2.0)
jquery-rails
jquery-ui-rails (~> 5.0.0)
letter_opener (~> 1.2.0)
mini_magick (~> 3.7.0)
mysql2
pry-plus
pry-rails
rails (= 4.1.0)
roadie (~> 3.0.0)
sass-rails (~> 4.0.3)
sdoc (~> 0.4.0)
settingslogic (~> 2.0.9)
simple_form (= 3.1.0rc1)
spring
sqlite3
turbolinks
uglifier (>= 1.3.0)
will_paginate (~> 3.0)
will_paginate-bootstrap
11 changes: 11 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard 'livereload' do
watch(%r{app/views/.+\.(erb|haml|slim)$})
watch(%r{app/helpers/.+\.rb})
watch(%r{public/.+\.(css|js|html)})
watch(%r{config/locales/.+\.yml})
# Rails Assets Pipeline
watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html|png|jpg))).*}) { |m| "/assets/#{m[3]}" }
end
Empty file removed README.md
Empty file.
3 changes: 3 additions & 0 deletions app/assets/javascripts/account/orders.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/javascripts/admin.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
90 changes: 90 additions & 0 deletions app/assets/javascripts/admin/jquery_customization.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
$(document).on('ready page:load', function(){

//initialize slide show
$("div.item:first-child").addClass("active");


//initialize spinner
var spinners = $( ".spinner" ).spinner({min: 1});

$.each( spinners , function(index,spinner){
//spinner is a DOM object
var max = parseInt($(this).attr("data_max"));
$(this).spinner( "option", "max", max);
var start_value = $(this).attr("data_start");
//fix the bug when product is not enough.
if(start_value > max){
start_value = max
}

$(this).spinner( "value", start_value);
update_cart_item_quantity(this,null,start_value,false);


$(this).on( "spin", function( event, ui ){
//console.log(ui.value);
update_cart_item_quantity(this,event,ui.value,true);
});

$(this).on( "spinchange", function(event , ui) {
var spin_value = parseInt($(this).attr("aria-valuenow"));
//console.log(this);
if(spin_value > max){
$(this).spinner( "value", max);
spin_value = max
}
update_cart_item_quantity(this,event,spin_value,true);

});

});

function update_cart_item_quantity(this_obj, event, update_quantity , submit){
var span = $(this_obj).closest("span");
var form = span.siblings("form");
var input_text = form.find("input[type='number']");
//var submit_button = form.find("input[type='submit']");
input_text.attr("value" , update_quantity);
if(submit == true){
form.submit();
}
}



//initialize state td
var tds = $('td.td_aasm_state');
$.each( tds , function(td){
nowstate = $(this).attr('data_nowstate');
setector_str = "li[data_state=" + nowstate + "]";
$(this).find(setector_str).addClass("active");


});

//initialize state li
var lis = $('div.pagination li');
$.each( lis , function(li){

$(this).on('click', function(){
console.log(li_siblings);
var li_siblings = $(this).siblings("li.active");
li_siblings.removeClass("active");
$(this).addClass("active");

var div = $(this).closest("div.pagination");
var form = div.siblings("form");
var input_text = form.find("input[type='text']");
var state = $(this).attr("data_state");
input_text.attr("value" , state);
form.submit();
});
});





//var tmpl = '<div class="input file optional photo_image form-group"><label class="file optional" for="photo_image">上傳圖片</label><input class="file optional form-control" id="photo_image" name="photo[image]" type="file"></div><label class="file optional" for="photo_image">上傳圖片</label><input class="file optional form-control" id="photo_image" name="photo[image]" type="file"></div>'

});
3 changes: 3 additions & 0 deletions app/assets/javascripts/admin/orders.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/javascripts/admin/photos.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/javascripts/admin/products.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
Loading