diff --git a/Gemfile b/Gemfile index 37bc11c..461aa00 100644 --- a/Gemfile +++ b/Gemfile @@ -2,11 +2,20 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'sextant' +gem "simple_form" +gem "carrierwave" +gem "mini_magick" +gem 'awesome_rails_console' +gem 'devise' +gem 'cocoon' +gem 'bootstrap-sass', '~> 3.3.6' gem 'rails', '4.2.4' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use SCSS for stylesheets -gem 'sass-rails', '~> 5.0' +gem 'bootstrap-sass', '~> 3.3.6' +gem 'sass-rails', '>= 3.2' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .coffee assets and views diff --git a/Gemfile.lock b/Gemfile.lock index dd98f6b..6df71bf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,10 +37,28 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) arel (6.0.3) + autoprefixer-rails (6.3.6) + execjs + awesome_print (1.6.1) + awesome_rails_console (0.4.0) + awesome_print + pry-rails + railties + bcrypt (3.1.11) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) + bootstrap-sass (3.3.6) + autoprefixer-rails (>= 5.2.1) + sass (>= 3.3.4) builder (3.2.2) byebug (8.2.4) + carrierwave (0.11.0) + activemodel (>= 3.2.0) + activesupport (>= 3.2.0) + json (>= 1.7) + mime-types (>= 1.16) + cocoon (1.2.9) + coderay (1.1.1) coffee-rails (4.1.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.1.x) @@ -50,6 +68,13 @@ GEM coffee-script-source (1.10.0) concurrent-ruby (1.0.1) debug_inspector (0.0.2) + devise (3.5.6) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 3.2.6, < 5) + responders + thread_safe (~> 0.1) + warden (~> 1.2.3) erubis (2.7.0) execjs (2.6.0) globalid (0.3.6) @@ -67,14 +92,23 @@ GEM nokogiri (>= 1.5.9) mail (2.6.4) mime-types (>= 1.16, < 4) + method_source (0.8.2) mime-types (3.0) mime-types-data (~> 3.2015) mime-types-data (3.2016.0221) + mini_magick (4.5.1) mini_portile2 (2.0.0) minitest (5.8.4) multi_json (1.11.2) nokogiri (1.6.7.2) mini_portile2 (~> 2.0.0.rc2) + orm_adapter (0.5.0) + pry (0.10.3) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + pry-rails (0.3.4) + pry (>= 0.9.10) rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) @@ -105,6 +139,8 @@ GEM rake (11.1.2) rdoc (4.2.2) json (~> 1.4) + responders (2.1.2) + railties (>= 4.2.0, < 5.1) sass (3.4.22) sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) @@ -115,6 +151,12 @@ GEM sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) + sextant (0.2.4) + rails (>= 3.2) + simple_form (3.2.1) + actionpack (> 4, < 5.1) + activemodel (> 4, < 5.1) + slop (3.6.0) spring (1.7.1) sprockets (3.6.0) concurrent-ruby (~> 1.0) @@ -133,6 +175,8 @@ GEM thread_safe (~> 0.1) uglifier (3.0.0) execjs (>= 0.3.0, < 3) + warden (1.2.6) + rack (>= 1.0) web-console (2.3.0) activemodel (>= 4.0) binding_of_caller (>= 0.7.2) @@ -143,13 +187,21 @@ PLATFORMS ruby DEPENDENCIES + awesome_rails_console + bootstrap-sass (~> 3.3.6) byebug + carrierwave + cocoon coffee-rails (~> 4.1.0) + devise jbuilder (~> 2.0) jquery-rails + mini_magick rails (= 4.2.4) - sass-rails (~> 5.0) + sass-rails (>= 3.2) sdoc (~> 0.4.0) + sextant + simple_form spring sqlite3 turbolinks diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index e07c5a8..f91cae5 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -11,6 +11,7 @@ // about supported directives. // //= require jquery +//= require bootstrap-sprockets //= require jquery_ujs //= require turbolinks //= require_tree . diff --git a/app/assets/javascripts/gymnasia.coffee b/app/assets/javascripts/gymnasia.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/gymnasia.coffee @@ -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/ diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.scss similarity index 92% rename from app/assets/stylesheets/application.css rename to app/assets/stylesheets/application.scss index f9cd5b3..f4123eb 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.scss @@ -13,3 +13,5 @@ *= require_tree . *= require_self */ +@import "bootstrap-sprockets"; +@import "bootstrap"; diff --git a/app/assets/stylesheets/gymnasia.scss b/app/assets/stylesheets/gymnasia.scss new file mode 100644 index 0000000..6deb9df --- /dev/null +++ b/app/assets/stylesheets/gymnasia.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the gymnasia controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/gymnasia_controller.rb b/app/controllers/gymnasia_controller.rb new file mode 100644 index 0000000..5e11d10 --- /dev/null +++ b/app/controllers/gymnasia_controller.rb @@ -0,0 +1,5 @@ +class GymnasiaController < ApplicationController + def index + @gymnasia = Gymnasium.all + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..242322a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,19 @@ module ApplicationHelper + def notice_message + alert_types = { notice: :success, alert: :danger } + + close_button_options = { class: "close", "data-dismiss" => "alert", "aria-hidden" => true } + close_button = content_tag(:button, "×", close_button_options) + + alerts = flash.map do |type, message| + alert_content = close_button + message + + alert_type = alert_types[type.to_sym] || type + alert_class = "alert alert-#{alert_type} alert-dismissable" + + content_tag(:div, alert_content, class: alert_class) + end + + alerts.join("\n").html_safe + end end diff --git a/app/helpers/gymnasia_helper.rb b/app/helpers/gymnasia_helper.rb new file mode 100644 index 0000000..8a7e213 --- /dev/null +++ b/app/helpers/gymnasia_helper.rb @@ -0,0 +1,2 @@ +module GymnasiaHelper +end diff --git a/app/models/gymnasium.rb b/app/models/gymnasium.rb new file mode 100644 index 0000000..4e7ea64 --- /dev/null +++ b/app/models/gymnasium.rb @@ -0,0 +1,2 @@ +class Gymnasium < ActiveRecord::Base +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..c822027 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,6 @@ +class User < ActiveRecord::Base + # Include default devise modules. Others available are: + # :confirmable, :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, :registerable, + :recoverable, :rememberable, :trackable, :validatable +end diff --git a/app/views/common/_navbar.html.erb b/app/views/common/_navbar.html.erb new file mode 100644 index 0000000..3a82baf --- /dev/null +++ b/app/views/common/_navbar.html.erb @@ -0,0 +1,37 @@ + + diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb new file mode 100644 index 0000000..949b172 --- /dev/null +++ b/app/views/devise/confirmations/new.html.erb @@ -0,0 +1,16 @@ +
Welcome <%= @email %>!
+ +You can confirm your account email through the link below:
+ +<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>
diff --git a/app/views/devise/mailer/password_change.html.erb b/app/views/devise/mailer/password_change.html.erb new file mode 100644 index 0000000..b41daf4 --- /dev/null +++ b/app/views/devise/mailer/password_change.html.erb @@ -0,0 +1,3 @@ +Hello <%= @resource.email %>!
+ +We're contacting you to notify you that your password has been changed.
diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb new file mode 100644 index 0000000..f667dc1 --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +Hello <%= @resource.email %>!
+ +Someone has requested a link to change your password. You can do this through the link below.
+ +<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>
+ +If you didn't request this, please ignore this email.
+Your password won't change until you access the link above and create a new one.
diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb new file mode 100644 index 0000000..41e148b --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +Hello <%= @resource.email %>!
+ +Your account has been locked due to an excessive number of unsuccessful sign in attempts.
+ +Click the link below to unlock your account:
+ +<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>
diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb new file mode 100644 index 0000000..a938930 --- /dev/null +++ b/app/views/devise/passwords/edit.html.erb @@ -0,0 +1,19 @@ +Currently waiting confirmation for: <%= resource.unconfirmed_email %>
+ <% end %> + + <%= f.input :password, :label => "密碼", autocomplete: "off", required: false, input_html: { class: 'form-control' } %>若無須變更 保持空白即可 + <%= f.input :password_confirmation, :label => "確認密碼", required: false , input_html: { class: 'form-control' } %> + <%= f.input :current_password, :label => "目前使用的密碼", required: true , input_html: { class: 'form-control' } %>我們需要您目前的密碼來確認您的變更 +不爽?想刪帳號 <%= link_to "那就點我啊", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>
+ + <%= link_to "返回", :back , class: "btn btn-primary" %> +