Skip to content
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
11 changes: 10 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
54 changes: 53 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// about supported directives.
//
//= require jquery
//= require bootstrap-sprockets
//= require jquery_ujs
//= require turbolinks
//= require_tree .
3 changes: 3 additions & 0 deletions app/assets/javascripts/gymnasia.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/
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
*= require_tree .
*= require_self
*/
@import "bootstrap-sprockets";
@import "bootstrap";
3 changes: 3 additions & 0 deletions app/assets/stylesheets/gymnasia.scss
Original file line number Diff line number Diff line change
@@ -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/
5 changes: 5 additions & 0 deletions app/controllers/gymnasia_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class GymnasiaController < ApplicationController
def index
@gymnasia = Gymnasium.all
end
end
17 changes: 17 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions app/helpers/gymnasia_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module GymnasiaHelper
end
2 changes: 2 additions & 0 deletions app/models/gymnasium.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Gymnasium < ActiveRecord::Base
end
6 changes: 6 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -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
37 changes: 37 additions & 0 deletions app/views/common/_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<nav id="mainNav" class="navbar navbar-default" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<%= root_path %>">Fitness Gym</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">

<ul class="nav navbar-nav navbar-right">
<% if !current_user %>
<li> <%= link_to("登入", new_user_session_path) %> </li>
<% else %>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Hi!, <%= current_user.name %>
<b class="caret"></b>
</a>
<li>
<%= link_to("登出", destroy_user_session_path, method: :delete ) %>
</li>
</ul>
</li>
<% end %>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>

16 changes: 16 additions & 0 deletions app/views/devise/confirmations/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<h2>Resend confirmation instructions</h2>

<%= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
<%= f.error_notification %>
<%= f.full_error :confirmation_token %>

<div class="form-inputs">
<%= f.input :email, required: true, autofocus: true %>
</div>

<div class="form-actions">
<%= f.button :submit, "Resend confirmation instructions" %>
</div>
<% end %>

<%= render "devise/shared/links" %>
5 changes: 5 additions & 0 deletions app/views/devise/mailer/confirmation_instructions.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<p>Welcome <%= @email %>!</p>

<p>You can confirm your account email through the link below:</p>

<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
3 changes: 3 additions & 0 deletions app/views/devise/mailer/password_change.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>Hello <%= @resource.email %>!</p>

<p>We're contacting you to notify you that your password has been changed.</p>
8 changes: 8 additions & 0 deletions app/views/devise/mailer/reset_password_instructions.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<p>Hello <%= @resource.email %>!</p>

<p>Someone has requested a link to change your password. You can do this through the link below.</p>

<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>

<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>
7 changes: 7 additions & 0 deletions app/views/devise/mailer/unlock_instructions.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<p>Hello <%= @resource.email %>!</p>

<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>

<p>Click the link below to unlock your account:</p>

<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
19 changes: 19 additions & 0 deletions app/views/devise/passwords/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<h2>Change your password</h2>

<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= f.error_notification %>

<%= f.input :reset_password_token, as: :hidden %>
<%= f.full_error :reset_password_token %>

<div class="form-inputs">
<%= f.input :password, label: "New password", required: true, autofocus: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
<%= f.input :password_confirmation, label: "Confirm your new password", required: true %>
</div>

<div class="form-actions">
<%= f.button :submit, "Change my password" %>
</div>
<% end %>

<%= render "devise/shared/links" %>
21 changes: 21 additions & 0 deletions app/views/devise/passwords/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h2>忘記密碼?</h2>

<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<%= devise_error_messages! %>

<div class="field">
<%= f.label :電子郵件 %><br />
<%= f.email_field :email, autofocus: true %>
</div>
<br>

<div class="actions">
<%= f.submit "寄送重新設定密碼郵件", class: "btn btn-success" %>
</div>
<% end %>

<%= render "devise/shared/links" %>
</div>
</div>
37 changes: 37 additions & 0 deletions app/views/devise/registrations/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<div class="login-panel panel panel-default">
<div class="panel-heading">
<h2>想改什麼帳號啦!</h2>
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= f.error_notification %>

<div class="form-inputs">
<%= f.input :email, :label => "電子郵件", required: true, autofocus: true, input_html: { class: 'form-control' } %>
<%= f.input :name, :label => "使用者名稱", input_html: { class: 'form-control' } %>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<p>Currently waiting confirmation for: <%= resource.unconfirmed_email %></p>
<% end %>

<%= f.input :password, :label => "密碼", autocomplete: "off", required: false, input_html: { class: 'form-control' } %><small>若無須變更 保持空白即可</small>
<%= f.input :password_confirmation, :label => "確認密碼", required: false , input_html: { class: 'form-control' } %>
<%= f.input :current_password, :label => "目前使用的密碼", required: true , input_html: { class: 'form-control' } %><small>我們需要您目前的密碼來確認您的變更</small>
</div>

<div class="form-actions">
<%= f.button :submit, "更新", class: "btn btn-primary" %>
</div>
<% end %>


<h3>取消我的帳號</h3>

<p>不爽?想刪帳號 <%= link_to "那就點我啊", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>

<%= link_to "返回", :back , class: "btn btn-primary" %>
</div>
</div>
</div>
</div>
</div>
27 changes: 27 additions & 0 deletions app/views/devise/registrations/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<div class="login-panel panel panel-default">
<div class="panel-heading">
<h2>會員註冊</h2>
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= f.error_notification %>

<div class="form-inputs">
<%= f.input :name, :label => "使用者名稱", required: true, input_html: { class: 'form-control' } %>
<%= f.input :email, :label => "電子郵件", required: true, autofocus: true, input_html: { class: 'form-control' } %>
<%= f.input :password, :label => "密碼", required: true, input_html: { class: 'form-control' } %>
<%= f.input :password_confirmation, :label => "確認密碼", required: true, input_html: { class: 'form-control' } %>
</div>
<br>
<div class="form-actions">
<%= f.button :submit, "註冊", class: "btn btn-primary" %>
</div>
<br>
<% end %>

<%= render "devise/shared/links" %>
</div>
</div>
</div>
</div>
Loading