Merge pull request #4 from indentlabs/notebook
work in progress: Notebook re-release
16
Gemfile
@ -1,21 +1,27 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
ruby "2.2.3"
|
||||
ruby '2.2.3'
|
||||
|
||||
gem 'rails', '4.2.0'
|
||||
gem 'rails'
|
||||
gem 'jquery-rails'
|
||||
gem 'sass-rails', '~> 4.0.3', require: 'sass'
|
||||
gem 'coffee-rails', '~> 4.0.0'
|
||||
gem 'sass-rails'
|
||||
gem 'coffee-rails'
|
||||
gem 'paperclip', '~> 4.2.0'
|
||||
gem 'rmagick', '2.13.4'
|
||||
gem 'aws-sdk', '~> 1.50'
|
||||
gem 'bcrypt', '~> 3.1.10', platforms: [:ruby, :mingw, :x64_mingw]
|
||||
gem 'devise'
|
||||
gem 'material_icons'
|
||||
|
||||
# Libraries
|
||||
#gem 'serendipitous', :path => "~/Code/indent/serendipitous-gem"
|
||||
gem 'serendipitous', :git => 'git://github.com/indentlabs/serendipitous-gem.git'
|
||||
|
||||
group :production do
|
||||
gem 'less-rails'
|
||||
gem 'less-rails-fontawesome'
|
||||
gem 'uglifier', '>= 1.3.0'
|
||||
gem 'bootplus-rails'
|
||||
#gem 'rails_12factor'
|
||||
end
|
||||
|
||||
group :test, :production do
|
||||
|
||||
38
Gemfile.lock
@ -1,3 +1,8 @@
|
||||
PATH
|
||||
remote: ~/Code/indent/serendipitous-gem
|
||||
specs:
|
||||
serendipitous (0.0.2)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
@ -45,7 +50,6 @@ GEM
|
||||
json (~> 1.4)
|
||||
nokogiri (>= 1.4.4)
|
||||
bcrypt (3.1.11)
|
||||
bcrypt (3.1.11-x86-mingw32)
|
||||
better_errors (2.1.1)
|
||||
coderay (>= 1.0.0)
|
||||
erubis (>= 2.6.6)
|
||||
@ -83,11 +87,17 @@ GEM
|
||||
thor (~> 0.19.1)
|
||||
tins (~> 1.6.0)
|
||||
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)
|
||||
docile (1.1.5)
|
||||
erubis (2.7.0)
|
||||
execjs (2.6.0)
|
||||
ffi (1.9.10)
|
||||
ffi (1.9.10-x86-mingw32)
|
||||
formatador (0.2.5)
|
||||
globalid (0.3.6)
|
||||
activesupport (>= 4.1.0)
|
||||
@ -130,6 +140,8 @@ GEM
|
||||
lumberjack (1.0.10)
|
||||
mail (2.6.4)
|
||||
mime-types (>= 1.16, < 4)
|
||||
material_icons (2.2.0)
|
||||
railties (>= 3.2)
|
||||
method_source (0.8.2)
|
||||
mime-types (3.0)
|
||||
mime-types-data (~> 3.2015)
|
||||
@ -140,11 +152,10 @@ GEM
|
||||
nenv (0.3.0)
|
||||
nokogiri (1.6.7.2)
|
||||
mini_portile2 (~> 2.0.0.rc2)
|
||||
nokogiri (1.6.7.2-x86-mingw32)
|
||||
mini_portile2 (~> 2.0.0.rc2)
|
||||
notiffany (0.0.8)
|
||||
nenv (~> 0.1)
|
||||
shellany (~> 0.0)
|
||||
orm_adapter (0.5.0)
|
||||
paperclip (4.2.4)
|
||||
activemodel (>= 3.2.0)
|
||||
activesupport (>= 3.2.0)
|
||||
@ -153,7 +164,6 @@ GEM
|
||||
parser (2.3.0.7)
|
||||
ast (~> 2.2)
|
||||
pg (0.18.4)
|
||||
pg (0.18.4-x86-mingw32)
|
||||
powerpack (0.1.1)
|
||||
pry (0.10.3)
|
||||
coderay (~> 1.1.0)
|
||||
@ -192,6 +202,8 @@ GEM
|
||||
rb-inotify (0.9.7)
|
||||
ffi (>= 0.5.0)
|
||||
ref (2.0.0)
|
||||
responders (2.1.2)
|
||||
railties (>= 4.2.0, < 5.1)
|
||||
rmagick (2.13.4)
|
||||
rubocop (0.39.0)
|
||||
parser (>= 2.3.0.7, < 3.0)
|
||||
@ -228,7 +240,6 @@ GEM
|
||||
activesupport (>= 3.0)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sqlite3 (1.3.11)
|
||||
sqlite3 (1.3.11-x86-mingw32)
|
||||
term-ansicolor (1.3.2)
|
||||
tins (~> 1.0)
|
||||
therubyracer (0.12.2)
|
||||
@ -245,37 +256,40 @@ GEM
|
||||
uglifier (3.0.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unicode-display_width (1.0.3)
|
||||
websocket (1.2.2)
|
||||
warden (1.2.6)
|
||||
rack (>= 1.0)
|
||||
websocket (1.2.3)
|
||||
xpath (2.0.0)
|
||||
nokogiri (~> 1.3)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
x86-mingw32
|
||||
|
||||
DEPENDENCIES
|
||||
aws-sdk (~> 1.50)
|
||||
bcrypt (~> 3.1.10)
|
||||
better_errors
|
||||
binding_of_caller
|
||||
bootplus-rails
|
||||
capybara
|
||||
coffee-rails (~> 4.0.0)
|
||||
coffee-rails
|
||||
coveralls
|
||||
devise
|
||||
guard
|
||||
guard-minitest
|
||||
guard-rubocop
|
||||
jquery-rails
|
||||
less-rails
|
||||
less-rails-fontawesome
|
||||
material_icons
|
||||
paperclip (~> 4.2.0)
|
||||
pg
|
||||
pry
|
||||
rails (= 4.2.0)
|
||||
rails
|
||||
rmagick (= 2.13.4)
|
||||
rubocop
|
||||
sass-rails (~> 4.0.3)
|
||||
sass-rails
|
||||
selenium-webdriver
|
||||
serendipitous!
|
||||
simplecov
|
||||
sqlite3
|
||||
therubyracer
|
||||
|
||||
9
Rakefile
@ -1,11 +1,2 @@
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically
|
||||
# be available to Rake.
|
||||
|
||||
require File.expand_path('../config/application', __FILE__)
|
||||
require 'rubocop/rake_task'
|
||||
|
||||
RuboCop::RakeTask.new
|
||||
task default: 'rubocop'
|
||||
|
||||
Rails.application.load_tasks
|
||||
|
||||
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 2.9 MiB |
BIN
app/assets/images/card-headers/items.jpg
Normal file
|
After Width: | Height: | Size: 6.2 MiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 3.3 MiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 640 KiB |
@ -9,5 +9,6 @@
|
||||
* compiled file, but it's generally better to create a new file per style scope.
|
||||
*
|
||||
*= require_self
|
||||
*= require material_icons
|
||||
*= require_tree .
|
||||
*/
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
.card {
|
||||
margin: 10px 0;
|
||||
padding-top: 15px;
|
||||
border: 1px solid #d8d8d8;
|
||||
border-bottom-width: 2px;
|
||||
border-top-width: 0;
|
||||
background-color: #ffffff;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-box-sizing: border-box;
|
||||
|
||||
.card-heading {
|
||||
text-transform: capitalize;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
color: #777;
|
||||
font-size: 20px;
|
||||
font-weight: 300;
|
||||
margin: 0 -15px;
|
||||
padding: 0px 35px 10px 35px;
|
||||
}
|
||||
|
||||
.card-image {
|
||||
|
||||
}
|
||||
|
||||
.card-body {
|
||||
padding: 10px 20px;
|
||||
font-family: Roboto, arial, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
color: #444444;
|
||||
|
||||
h2 {
|
||||
font-size: 29px;
|
||||
small {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-comments {
|
||||
padding: 20px;
|
||||
margin: 0;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
/*
|
||||
Place all the styles related to the matching controller here.
|
||||
They will automatically be included in application.css.
|
||||
*/
|
||||
9
app/assets/stylesheets/footer.css
Normal file
@ -0,0 +1,9 @@
|
||||
body {
|
||||
display: flex;
|
||||
min-height: 100vh;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1 0 auto;
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
form {
|
||||
.text_field {
|
||||
padding: 0 8px;
|
||||
border-top: 1px solid #c0c0c0;
|
||||
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
-moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
min-height: 29px;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #d9d9d9;
|
||||
-webkit-transition: border linear .2s, box-shadow linear .2s;
|
||||
-moz-transition: border linear .2s, box-shadow linear .2s;
|
||||
-o-transition: border linear .2s, box-shadow linear .2s;
|
||||
transition: border linear .2s, box-shadow linear .2s;
|
||||
}
|
||||
}
|
||||
|
||||
#placeholder_map_input {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
#landing-page-1 {
|
||||
|
||||
#content-types {
|
||||
.card {
|
||||
img {
|
||||
height: 200px;
|
||||
width: 100%;
|
||||
}
|
||||
min-height: 400px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
// Place all the styles related to the languages controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
@ -1,21 +0,0 @@
|
||||
.navbar-fixed-top {
|
||||
border-bottom: 1px solid #d8d8d8 !important;
|
||||
background-color: #ffffff;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-box-sizing: border-box;
|
||||
|
||||
& a {
|
||||
color: #777777;
|
||||
&:hover {
|
||||
color: #000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
.footer {
|
||||
margin-top: 120px;
|
||||
|
||||
& p {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
.nav-stacked {
|
||||
.active {
|
||||
border-left: 3px solid #777;
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
body {
|
||||
margin-top: 60px !important;
|
||||
background: #e5e5e5 !important;
|
||||
}
|
||||
|
||||
.section {
|
||||
margin: 30px 0;
|
||||
}
|
||||
@ -2,71 +2,6 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery
|
||||
|
||||
helper :html
|
||||
helper :my_content
|
||||
|
||||
helper_method :nl2br
|
||||
helper_method :universe_filter
|
||||
|
||||
# Rails changed cookie format in rails 4, so log out all old users so that
|
||||
# they get the new version
|
||||
rescue_from JSON::ParserError, with: :force_user_logout
|
||||
def force_user_logout
|
||||
reset_session
|
||||
redirect_to login_path
|
||||
end
|
||||
|
||||
# View Helpers
|
||||
def nl2br(string)
|
||||
# simple_format string
|
||||
string.gsub("\n\r", '<br>').gsub("\r", '').gsub("\n", '<br />').html_safe
|
||||
end
|
||||
|
||||
def universe_filter
|
||||
return if User.find_by(id: session[:user]).universes.empty?
|
||||
@selected_universe_filter ||= t(:all_universes)
|
||||
end
|
||||
|
||||
# Authentication
|
||||
# replace with devise
|
||||
def log_in(user)
|
||||
session[:user] = user.id
|
||||
end
|
||||
|
||||
def logged_in?
|
||||
session && session[:user]
|
||||
end
|
||||
|
||||
def redirect_if_not_logged_in
|
||||
return if logged_in?
|
||||
redirect_to signup_path, notice: t(:must_be_logged_in)
|
||||
end
|
||||
|
||||
def create_anonymous_account_if_not_logged_in
|
||||
return if logged_in?
|
||||
|
||||
# layman's collision detection
|
||||
10.times do
|
||||
@user = create_anonymous_user
|
||||
break if @user.save
|
||||
end
|
||||
|
||||
return if @user.nil?
|
||||
|
||||
session[:user] = @user.id
|
||||
session[:anon_user] = true
|
||||
end
|
||||
|
||||
def create_anonymous_user
|
||||
# TODO: guarantee anonymous id is random (or just let db assign it?)
|
||||
id = rand(10_000_000).to_s + rand(10_000_000).to_s # lol
|
||||
|
||||
User.new(
|
||||
name: 'Anonymous-' + id.to_s,
|
||||
email: id.to_s + '@localhost',
|
||||
password: id.to_s)
|
||||
end
|
||||
|
||||
def content_type_from_controller(content_controller_name)
|
||||
content_controller_name.to_s.chomp('Controller').singularize.constantize
|
||||
end
|
||||
|
||||
@ -1,15 +1,21 @@
|
||||
# Controller for the Character model
|
||||
class CharactersController < ContentController
|
||||
|
||||
private
|
||||
|
||||
def content_params
|
||||
params.require(:character).permit(
|
||||
params.require(:character).permit(content_param_list)
|
||||
end
|
||||
|
||||
def content_param_list
|
||||
[
|
||||
:universe_id, :user_id,
|
||||
:name, :age, :role, :gender, :age, :height, :weight, :haircolor,
|
||||
:facialhair, :eyecolor, :race, :skintone, :bodytype, :identmarks,
|
||||
:bestfriend, :religion, :politics, :prejudices, :occupation, :pets,
|
||||
:mannerisms, :birthday, :birthplace, :education, :background,
|
||||
:fave_color, :fave_food, :fave_possession, :fave_weapon, :fave_animal,
|
||||
:father, :mother, :spouse, :siblings, :archenemy, :notes, :private_notes)
|
||||
:father, :mother, :spouse, :siblings, :archenemy, :notes, :private_notes
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@ -42,7 +42,7 @@ module HasOwnership
|
||||
end
|
||||
|
||||
def owned_by_current_user?(object)
|
||||
session[:user] && session[:user] == object.user.id
|
||||
current_user == object.user
|
||||
end
|
||||
|
||||
def visible?(object)
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
class ContentController < ApplicationController
|
||||
include HasOwnership
|
||||
|
||||
before_action :create_anonymous_account_if_not_logged_in, only: [:edit, :create, :update]
|
||||
before_action :authenticate_user!
|
||||
|
||||
# TODO: put a lot of this in ContentManagementService
|
||||
|
||||
def index
|
||||
@content = content_type_from_controller(self.class)
|
||||
.where(user_id: session[:user])
|
||||
.where(user_id: current_user.id)
|
||||
.order(:name)
|
||||
.presence || []
|
||||
|
||||
@ -16,8 +18,9 @@ class ContentController < ApplicationController
|
||||
end
|
||||
|
||||
def show
|
||||
@content = content_type_from_controller(self.class)
|
||||
.find(params[:id])
|
||||
# TODO: Secure this with content class whitelist lel
|
||||
@content = content_type_from_controller(self.class).find(params[:id])
|
||||
@question = QuestionService.question(Content.new @content.slice(*content_param_list))
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
@ -77,7 +80,7 @@ class ContentController < ApplicationController
|
||||
@content = content_type
|
||||
.new(content_params)
|
||||
.tap do |c|
|
||||
c.user_id = session[:user]
|
||||
c.user_id = current_user.id
|
||||
c.universe = universe_from_params if c.respond_to? :universe #todo this doesn't actually work?
|
||||
end
|
||||
end
|
||||
@ -89,7 +92,7 @@ class ContentController < ApplicationController
|
||||
|
||||
def universe_from_params
|
||||
return unless params[content_symbol].include? :universe
|
||||
Universe.where(user_id: session[:user], name: params[content_symbol][:universe].strip).first
|
||||
Universe.where(user_id: current_user.id, name: params[content_symbol][:universe].strip).first
|
||||
end
|
||||
|
||||
def content_symbol
|
||||
|
||||
@ -1,14 +1,19 @@
|
||||
# Controller for the Equipment model
|
||||
class EquipmentController < ContentController
|
||||
class ItemsController < ContentController
|
||||
private
|
||||
|
||||
def content_params
|
||||
params.require(:equipment).permit(
|
||||
params.require(:item).permit(content_param_list)
|
||||
end
|
||||
|
||||
def content_param_list
|
||||
[
|
||||
:universe_id, :user_id,
|
||||
:name, :equip_type,
|
||||
:name, :item_type,
|
||||
:description, :weight,
|
||||
:original_owner, :current_owner, :made_by, :materials, :year_made,
|
||||
:magic,
|
||||
:notes, :private_notes)
|
||||
:notes, :private_notes
|
||||
]
|
||||
end
|
||||
end
|
||||
@ -1,14 +0,0 @@
|
||||
# Controller for the Language model
|
||||
class LanguagesController < ContentController
|
||||
private
|
||||
|
||||
def content_params
|
||||
params.require(:language).permit(
|
||||
:user_id, :universe_id,
|
||||
:name,
|
||||
:words,
|
||||
:established_year, :established_location,
|
||||
:characters, :locations,
|
||||
:notes)
|
||||
end
|
||||
end
|
||||
@ -3,10 +3,15 @@ class LocationsController < ContentController
|
||||
private
|
||||
|
||||
def content_params
|
||||
params.require(:location).permit(
|
||||
:universe_id, :user_id, :name, :type_of, :description, :map,
|
||||
params.require(:location).permit(content_param_list)
|
||||
end
|
||||
|
||||
def content_param_list
|
||||
[
|
||||
:universe_id, :user_id, :name, :type_of, :description, #:map,
|
||||
:population, :currency, :motto, :capital, :largest_city, :notable_cities,
|
||||
:area, :crops, :located_at, :stablishment_year, :notable_wars,
|
||||
:notes, :private_notes)
|
||||
:area, :crops, :located_at, :established_year, :notable_wars,
|
||||
:notes, :private_notes
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
# Controller for the Magic model
|
||||
class MagicController < ContentController
|
||||
private
|
||||
|
||||
def content_params
|
||||
params.require(:magic).permit(
|
||||
:universe_id, :user_id,
|
||||
:name, :type_of,
|
||||
:manifestation, :symptoms,
|
||||
:element, :diety,
|
||||
:harmfulness, :helpfulness, :neutralness,
|
||||
:resource, :skill_level, :limitations,
|
||||
:notes, :private_notes)
|
||||
end
|
||||
end
|
||||
@ -1,10 +1,8 @@
|
||||
# Controller for top-level pages of the site that do not have
|
||||
# an associated model
|
||||
class MainController < ApplicationController
|
||||
before_action :redirect_if_not_logged_in, only: [:dashboard]
|
||||
|
||||
def index
|
||||
redirect_to :dashboard if session && session[:user]
|
||||
redirect_to :dashboard if user_signed_in?
|
||||
end
|
||||
|
||||
def comingsoon
|
||||
@ -17,15 +15,5 @@ class MainController < ApplicationController
|
||||
end
|
||||
|
||||
def dashboard
|
||||
user = User.where(id: session[:user]).first
|
||||
|
||||
@characters = user.characters
|
||||
@equipment = user.equipment
|
||||
@languages = user.languages
|
||||
@locations = user.locations
|
||||
@magics = user.magics
|
||||
@universes = user.universes
|
||||
|
||||
@things = user.content_count
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,76 +0,0 @@
|
||||
# Controller for user Sessions
|
||||
class SessionsController < ApplicationController
|
||||
# GET /sessions/new
|
||||
# GET /sessions/new.json
|
||||
def new
|
||||
@session = Session.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @session }
|
||||
end
|
||||
end
|
||||
|
||||
# POST /sessions
|
||||
# POST /sessions.json
|
||||
def create
|
||||
user = user_from_params
|
||||
|
||||
if user.nil?
|
||||
redirect_to login_path, notice: t(:username_password_incorrect)
|
||||
return
|
||||
end
|
||||
|
||||
build_session_for user
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to dashboard_path, notice: t(:login_successful) }
|
||||
format.json { render json: true, status: :created }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /logout
|
||||
def destroy
|
||||
session.delete(:user)
|
||||
session.delete(:anon_user)
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to homepage_path, notice: t(:logged_out) }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
def self.create_password_digest(username, password)
|
||||
require 'digest'
|
||||
Digest::MD5.hexdigest(
|
||||
username + "'s password IS... " + password + ' (lol!)')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def user_from_params
|
||||
login = Session.new(session_params)
|
||||
user = User.find_by(name: login.username)
|
||||
migrate_to_bcrypt(user, login.password) if user.old_password.present?
|
||||
user.try(:authenticate, login.password)
|
||||
end
|
||||
|
||||
def migrate_to_bcrypt(user, password)
|
||||
hash = SessionsController.create_password_digest user.name, password
|
||||
|
||||
return unless user.old_password == hash
|
||||
|
||||
user.old_password = nil
|
||||
user.password = password
|
||||
user.save
|
||||
end
|
||||
|
||||
def build_session_for(user)
|
||||
session[:user] = user.id
|
||||
session.delete(:anon_user)
|
||||
end
|
||||
|
||||
def session_params
|
||||
params.require(:session).permit(:username, :password)
|
||||
end
|
||||
end
|
||||
@ -3,11 +3,16 @@ class UniversesController < ContentController
|
||||
private
|
||||
|
||||
def content_params
|
||||
params.require(:universe).permit(
|
||||
params.require(:universe).permit(content_param_list)
|
||||
end
|
||||
|
||||
def content_param_list
|
||||
[
|
||||
:user_id,
|
||||
:name, :description,
|
||||
:history,
|
||||
:privacy,
|
||||
:notes, :private_notes)
|
||||
:notes, :private_notes
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
# Controller for the User model
|
||||
#todo not sure this is even needed with devise
|
||||
class UsersController < ApplicationController
|
||||
before_action :redirect_if_not_logged_in, only: [:edit, :update]
|
||||
|
||||
# GET /users/new
|
||||
# GET /users/new.json
|
||||
def new
|
||||
@ -15,7 +14,7 @@ class UsersController < ApplicationController
|
||||
|
||||
# GET /users/1/edit
|
||||
def edit
|
||||
@user = User.find(session[:user])
|
||||
@user = current_user #todo just use current_user in view
|
||||
end
|
||||
|
||||
# POST /users
|
||||
@ -27,23 +26,7 @@ class UsersController < ApplicationController
|
||||
if @user.save
|
||||
log_in @user
|
||||
notice = t(:create_success, model_name: User.model_name.human)
|
||||
format.html { redirect_to homepage_path, notice: notice }
|
||||
format.json { render json: @user, status: :created }
|
||||
else
|
||||
format.html { render action: 'new' }
|
||||
format.json { render json: @user.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def anonymous_login
|
||||
@user = create_anonymous_user
|
||||
|
||||
respond_to do |format|
|
||||
if @user.save
|
||||
session[:user] = @user.id
|
||||
session[:anon_user] = true
|
||||
format.html { redirect_to dashboard_path }
|
||||
format.html { redirect_to root_url, notice: notice }
|
||||
format.json { render json: @user, status: :created }
|
||||
else
|
||||
format.html { render action: 'new' }
|
||||
@ -55,12 +38,11 @@ class UsersController < ApplicationController
|
||||
# PUT /users/1
|
||||
# PUT /users/1.json
|
||||
def update
|
||||
@user = User.find(session[:user])
|
||||
@user = current_user
|
||||
|
||||
respond_to do |format|
|
||||
if @user.update_attributes(user_params)
|
||||
session[:anon_user] = false
|
||||
format.html { redirect_to homepage_path, notice: 'Successfully updated.' }
|
||||
format.html { redirect_to root_url, notice: 'Successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: 'edit' }
|
||||
@ -69,13 +51,9 @@ class UsersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def anonymous
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit(:name, :email,
|
||||
:password, :password_confirmation)
|
||||
params.require(:user).permit(:name, :email, :password, :password_confirmation)
|
||||
end
|
||||
end
|
||||
|
||||
@ -4,8 +4,7 @@ module ApplicationHelper
|
||||
# current logged-in user. Otherwise will just print a text title
|
||||
def link_if_present(name, type)
|
||||
return name unless session[:user]
|
||||
userid = User.where(id: session[:user]).first.id
|
||||
result = find_by_name_and_type name, type.downcase, userid
|
||||
result = find_by_name_and_type name, type.downcase, current_user.id
|
||||
|
||||
result.nil? ? name : link_to(name, result)
|
||||
end
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
module ContentHelper
|
||||
end
|
||||
@ -1,32 +0,0 @@
|
||||
# Helps to generate forms and buttons
|
||||
module FormHelper
|
||||
def generate_form_row_for(form_handler, field, label_override = nil, toolbox = {})
|
||||
label = (label_override.nil? ? field : label_override.titleize)
|
||||
[
|
||||
'<div class="row">',
|
||||
'<div class="col-xs-2" style="text-align: right;">',
|
||||
form_handler.label(label, class: 'control-label'),
|
||||
'</div>',
|
||||
'<div class="col-xs-9">',
|
||||
form_handler.text_field(field, class: 'form-control'),
|
||||
'</div>',
|
||||
'<div class="col-xs-1">',
|
||||
toolbox.map { |config| toolbox_button_for(config) },
|
||||
'</div>',
|
||||
'</div>'
|
||||
].join("\n").html_safe
|
||||
end
|
||||
|
||||
def toolbox_button_for(config = {})
|
||||
if config[:action].ends_with? '_picker'
|
||||
picker_type = config[:action].split('_picker').first
|
||||
picker_for picker_type
|
||||
else
|
||||
[
|
||||
"<button type='button' class='btn btn-default #{config[:action]}'>",
|
||||
"<span class='glyphicon glyphicon-#{config[:icon]}'></span>",
|
||||
'</button>'
|
||||
].join("\n").html_safe
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,34 +0,0 @@
|
||||
# Helps generate small HTML constructs
|
||||
module HtmlHelper
|
||||
PICKER_ICONS = {
|
||||
'character' => 'user',
|
||||
'universe' => 'globe',
|
||||
'equipment' => 'gift',
|
||||
'language' => 'comment',
|
||||
'location' => 'road'
|
||||
}
|
||||
|
||||
def picker_for(content_type)
|
||||
content_array = send "my_#{content_type.pluralize}"
|
||||
generate_picker_code_for(content_array, PICKER_ICONS[content_type])
|
||||
rescue
|
||||
end
|
||||
|
||||
def generate_picker_code_for(content_array, glyphicon_id)
|
||||
return if content_array.length == 0
|
||||
[
|
||||
'<span class="dropdown-picker">',
|
||||
'<button type="button" class="btn btn-default dropdown-toggle" \
|
||||
data-toggle="dropdown">',
|
||||
'<span class="glyphicon glyphicon-' + glyphicon_id + '"></span>',
|
||||
'<span class="caret"></span>',
|
||||
'</button>',
|
||||
'<ul class="dropdown-menu">',
|
||||
content_array.map do |content|
|
||||
'<li><a href="#">' + content.name + '</a></li>'
|
||||
end,
|
||||
'</ul>',
|
||||
'</span>'
|
||||
].join("\n").html_safe
|
||||
end
|
||||
end
|
||||
@ -1,8 +0,0 @@
|
||||
# Helps to get content owned by the current user
|
||||
module MyContentHelper
|
||||
%w(characters universes equipment languages locations).each do |content_type|
|
||||
define_method "my_#{content_type}" do
|
||||
content_type.singularize.titleize.constantize.where(user_id: session[:user])
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -7,26 +7,57 @@
|
||||
#
|
||||
# exists within a Universe.
|
||||
class Character < ActiveRecord::Base
|
||||
include Comparable
|
||||
include NilsBlankUniverse
|
||||
|
||||
validates :name, presence: true
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :universe
|
||||
|
||||
def <=>(other)
|
||||
name.downcase <=> other.name.downcase
|
||||
def description
|
||||
role
|
||||
end
|
||||
|
||||
def card_title
|
||||
name
|
||||
def self.color
|
||||
'red'
|
||||
end
|
||||
|
||||
def card_subtitle
|
||||
[
|
||||
role,
|
||||
age
|
||||
].compact.join ', '
|
||||
def self.icon
|
||||
'group'
|
||||
end
|
||||
|
||||
def self.attribute_categories
|
||||
{
|
||||
general_information: {
|
||||
icon: 'info',
|
||||
attributes: %w(name role gender age universe_id),
|
||||
},
|
||||
appearance: {
|
||||
icon: 'face',
|
||||
attributes: %w(weight height haircolor hairstyle facialhair eyecolor race skintone bodytype identmarks)
|
||||
},
|
||||
social: {
|
||||
icon: 'groups',
|
||||
attributes: %w(bestfriend religion politics prejudices occupation)
|
||||
},
|
||||
mannerisms: {
|
||||
icon: 'groups',
|
||||
attributes: %w(mannerisms)
|
||||
},
|
||||
history: {
|
||||
icon: 'info',
|
||||
attributes: %w(birthday birthplace education background)
|
||||
},
|
||||
favorites: {
|
||||
icon: 'star',
|
||||
attributes: %w(fave_color fave_food fave_possession fave_weapon fave_animal)
|
||||
},
|
||||
relationships: {
|
||||
icon: 'face',
|
||||
attributes: %w(mother father spouse siblings archenemy)
|
||||
},
|
||||
notes: {
|
||||
icon: 'edit',
|
||||
attributes: %w(notes private_notes)
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
require 'active_support/concern'
|
||||
|
||||
# Model will set its Universe attribute to nil if the string is blank
|
||||
module NilsBlankUniverse
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
before_save :nil_blank_universe
|
||||
end
|
||||
|
||||
def nil_blank_universe
|
||||
self.universe = nil if universe.blank?
|
||||
end
|
||||
end
|
||||
@ -1,29 +0,0 @@
|
||||
##
|
||||
# = e-quip-ment
|
||||
# == /e'kwipment/
|
||||
# _noun_
|
||||
#
|
||||
# 1. the necessary items for a particular purpose.
|
||||
#
|
||||
# exists within a Universe.
|
||||
class Equipment < ActiveRecord::Base
|
||||
include Comparable
|
||||
include NilsBlankUniverse
|
||||
|
||||
validates :name, presence: true
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :universe
|
||||
|
||||
def <=>(other)
|
||||
name.downcase <=> other.name.downcase
|
||||
end
|
||||
|
||||
def table_columns
|
||||
{
|
||||
'Name' => -> { link_to name, self },
|
||||
'Type' => equip_type,
|
||||
'Description' => description
|
||||
}
|
||||
end
|
||||
end
|
||||
47
app/models/item.rb
Normal file
@ -0,0 +1,47 @@
|
||||
##
|
||||
# = e-quip-ment
|
||||
# == /e'kwipment/
|
||||
# _noun_
|
||||
#
|
||||
# 1. the necessary items for a particular purpose.
|
||||
#
|
||||
# exists within a Universe.
|
||||
class Item < ActiveRecord::Base
|
||||
validates :name, presence: true
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :universe
|
||||
|
||||
def self.color
|
||||
'amber'
|
||||
end
|
||||
|
||||
def self.icon
|
||||
'beach_access'
|
||||
end
|
||||
|
||||
def self.attribute_categories
|
||||
{
|
||||
general_information: {
|
||||
icon: 'info',
|
||||
attributes: %w(name item_type description universe),
|
||||
},
|
||||
appearance: {
|
||||
icon: 'face',
|
||||
attributes: %w(weight)
|
||||
},
|
||||
history: {
|
||||
icon: 'face',
|
||||
attributes: %w(original_owner current_owner made_by materials year_made)
|
||||
},
|
||||
abilities: {
|
||||
icon: 'face',
|
||||
attributes: %w(magic)
|
||||
},
|
||||
notes: {
|
||||
icon: 'edit',
|
||||
attributes: %w(notes private_notes)
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
@ -1,17 +0,0 @@
|
||||
##
|
||||
# = lang-guage
|
||||
# == /'laNGgqwij/
|
||||
# _noun_
|
||||
#
|
||||
# 1. the method of communication, either spoken or written, consisting of the
|
||||
# use of words in a structured and conventional way.
|
||||
#
|
||||
# spoken within a Universe
|
||||
class Language < ActiveRecord::Base
|
||||
include NilsBlankUniverse
|
||||
|
||||
validates :name, presence: true
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :universe
|
||||
end
|
||||
@ -7,8 +7,6 @@
|
||||
#
|
||||
# exists within a Universe
|
||||
class Location < ActiveRecord::Base
|
||||
include NilsBlankUniverse
|
||||
|
||||
has_attached_file :map, styles: { original: '1920x1080>', thumb: '200x200>' }
|
||||
validates_attachment_content_type :map, content_type: %r{\Aimage\/.*\Z}
|
||||
|
||||
@ -16,4 +14,42 @@ class Location < ActiveRecord::Base
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :universe
|
||||
|
||||
def self.icon
|
||||
'terrain'
|
||||
end
|
||||
|
||||
def self.color
|
||||
'green'
|
||||
end
|
||||
|
||||
def self.attribute_categories
|
||||
{
|
||||
general_information: {
|
||||
icon: 'info',
|
||||
attributes: %w(name type_of description universe),
|
||||
},
|
||||
#todo map
|
||||
culture: {
|
||||
icon: 'face',
|
||||
attributes: %w(population language currency motto)
|
||||
},
|
||||
cities: {
|
||||
icon: 'face',
|
||||
attributes: %w(capital largest_city notable_cities)
|
||||
},
|
||||
geography: {
|
||||
icon: 'edit',
|
||||
attributes: %w(area crops located_at)
|
||||
},
|
||||
history: {
|
||||
icon: 'edit',
|
||||
attributes: %w(established_year notable_wars)
|
||||
},
|
||||
notes: {
|
||||
icon: 'edit',
|
||||
attributes: %w(notes private_notes)
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
##
|
||||
# = mag-ic
|
||||
# == /'majik/
|
||||
# _noun_
|
||||
#
|
||||
# 1. the power of apparently influencing the course of events by using
|
||||
# mysterious or supernatural forces.
|
||||
#
|
||||
# used within a universe
|
||||
#
|
||||
# "do you believe in magic?"
|
||||
class Magic < ActiveRecord::Base
|
||||
include NilsBlankUniverse
|
||||
|
||||
validates :name, presence: true
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :universe
|
||||
end
|
||||
@ -1,6 +0,0 @@
|
||||
##
|
||||
# A currently-logged-in User
|
||||
class Session < ActiveRecord::Base
|
||||
validates :username, presence: true
|
||||
validates :password, presence: true
|
||||
end
|
||||
@ -10,7 +10,7 @@ class Universe < ActiveRecord::Base
|
||||
|
||||
belongs_to :user
|
||||
has_many :characters
|
||||
has_many :equipment
|
||||
has_many :items
|
||||
has_many :languages
|
||||
has_many :locations
|
||||
has_many :magics
|
||||
@ -18,10 +18,39 @@ class Universe < ActiveRecord::Base
|
||||
def content_count
|
||||
[
|
||||
characters.length,
|
||||
equipment.length,
|
||||
items.length,
|
||||
languages.length,
|
||||
locations.length,
|
||||
magics.length
|
||||
].sum
|
||||
end
|
||||
|
||||
def self.color
|
||||
'purple'
|
||||
end
|
||||
|
||||
def self.icon
|
||||
'vpn_lock'
|
||||
end
|
||||
|
||||
def self.attribute_categories
|
||||
{
|
||||
general_information: {
|
||||
icon: 'info',
|
||||
attributes: %w(name description),
|
||||
},
|
||||
history: {
|
||||
icon: 'face',
|
||||
attributes: %w(history)
|
||||
},
|
||||
settings: {
|
||||
icon: 'face',
|
||||
attributes: %w(privacy)
|
||||
},
|
||||
notes: {
|
||||
icon: 'edit',
|
||||
attributes: %w(notes private_notes)
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,32 +1,25 @@
|
||||
##
|
||||
# a person using the Indent web application. Owns all other content.
|
||||
class User < ActiveRecord::Base
|
||||
validates :name, presence: true
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||
devise :database_authenticatable, :registerable,
|
||||
:recoverable, :rememberable, :trackable, :validatable
|
||||
|
||||
#validates :name, presence: true
|
||||
validates :email, presence: true
|
||||
|
||||
has_secure_password
|
||||
before_save :hash_old_password
|
||||
|
||||
has_many :characters
|
||||
has_many :equipment
|
||||
has_many :items
|
||||
has_many :languages
|
||||
has_many :locations
|
||||
has_many :magics
|
||||
has_many :universes
|
||||
|
||||
def hash_old_password
|
||||
require 'digest'
|
||||
|
||||
return if old_password.blank?
|
||||
|
||||
self.old_password = Digest::MD5.hexdigest(
|
||||
name + "'s password IS... " + old_password + ' (lol!)')
|
||||
end
|
||||
|
||||
def content
|
||||
{
|
||||
characters: characters,
|
||||
equipment: equipment,
|
||||
items: items,
|
||||
languages: languages,
|
||||
locations: locations,
|
||||
magics: magics,
|
||||
@ -37,7 +30,7 @@ class User < ActiveRecord::Base
|
||||
def content_count
|
||||
[
|
||||
characters.length,
|
||||
equipment.length,
|
||||
items.length,
|
||||
languages.length,
|
||||
locations.length,
|
||||
magics.length,
|
||||
|
||||
11
app/views/cards/_character_intro.html.erb
Normal file
@ -0,0 +1,11 @@
|
||||
<div class="card hoverable">
|
||||
<div class="card-image">
|
||||
<%= image_tag 'card-headers/characters.jpg' %>
|
||||
<span class="card-title">Create characters</span>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<p>
|
||||
Plan physical appearance, behaviorisms, social roles, family – even a favorite color!
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
11
app/views/cards/_item_intro.html.erb
Normal file
@ -0,0 +1,11 @@
|
||||
<div class="card hoverable">
|
||||
<div class="card-image">
|
||||
<%= image_tag 'card-headers/items.jpg' %>
|
||||
<span class="card-title">Track items</span>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<p>
|
||||
Every weapon was made by someone, and every book has an owner. Keep track of every aspect of your items.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
11
app/views/cards/_location_intro.html.erb
Normal file
@ -0,0 +1,11 @@
|
||||
<div class="card hoverable">
|
||||
<div class="card-image">
|
||||
<%= image_tag 'card-headers/locations.jpg' %>
|
||||
<span class="card-title">Construct locations</span>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<p>
|
||||
Upload maps, link areas, track demographics, and keep track of history.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
11
app/views/cards/_universe_intro.html.erb
Normal file
@ -0,0 +1,11 @@
|
||||
<div class="card hoverable">
|
||||
<div class="card-image">
|
||||
<%= image_tag 'card-headers/universes.jpg' %>
|
||||
<span class="card-title">Build universes</span>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<p>
|
||||
You know you've always wanted to create <em>an entire universe</em>. Now's your chance!
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
17
app/views/cards/serendipitous/_content_question.html.erb
Normal file
@ -0,0 +1,17 @@
|
||||
<% if question %>
|
||||
<div class="card-panel hoverable light-blue lighten-4">
|
||||
<i class="material-icons <%= content.class.color %> circle right white-text"><%= content.class.icon %>`</i>
|
||||
<%= question[:question] %>
|
||||
|
||||
<form>
|
||||
<%# TODO: Support dropdown, picker, etc for relations %>
|
||||
<div class="input-field">
|
||||
<input id="last_name" type="text" class="validate">
|
||||
<label for="last_name"><%= question[:field].humanize %></label>
|
||||
</div>
|
||||
<div>
|
||||
<a class="waves-effect waves-light btn">save</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<% end %>
|
||||
7
app/views/cards/ui/_alert.html.erb
Normal file
@ -0,0 +1,7 @@
|
||||
<% if alert %>
|
||||
<div class="card-panel amber darken-3 hoverable">
|
||||
<span class="white-text">
|
||||
<%= alert %>
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
7
app/views/cards/ui/_notice.html.erb
Normal file
@ -0,0 +1,7 @@
|
||||
<% if notice %>
|
||||
<div class="card-panel light-blue darken-3 hoverable">
|
||||
<span class="white-text">
|
||||
<%= notice %>
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
4
app/views/cards/user/_recent_activity.html.erb
Normal file
@ -0,0 +1,4 @@
|
||||
<% all_content = %i(universes characters locations items).map { |c| current_user.send(c) }.flatten.sort_by(&:created_at).reverse.first(10) %>
|
||||
<% if all_content.count > 0 %>
|
||||
<%= render partial: 'content/list/list', locals: { content_list: all_content, title: 'Recent creations' } %>
|
||||
<% end %>
|
||||
@ -1,71 +0,0 @@
|
||||
<div class="hidden section starter_section general_section">
|
||||
<%= generate_form_row_for(f, :name, nil, [{:action => 'character_name_generator', :icon => 'random'}]) %>
|
||||
<%= generate_form_row_for(f, :role, 'Role in story') %>
|
||||
<%= generate_form_row_for(f, :gender) %>
|
||||
<%= generate_form_row_for(f, :age, nil, [{:action => 'character_age_generator', :icon => 'random'}]) %>
|
||||
<%= generate_form_row_for(f, :universe, nil, [{:action => 'universe_picker', :icon => 'globe'}]) %>
|
||||
</div>
|
||||
|
||||
<div class="hidden section starter_section appearance_section">
|
||||
<%= generate_form_row_for(f, :height) %>
|
||||
<%= generate_form_row_for(f, :weight) %>
|
||||
<%= generate_form_row_for(f, :race) %>
|
||||
<%= generate_form_row_for(f, :haircolor) %>
|
||||
<%= generate_form_row_for(f, :hairstyle) %>
|
||||
<%= generate_form_row_for(f, :facialhair) %>
|
||||
<%= generate_form_row_for(f, :eyecolor, 'Eye color') %>
|
||||
<%= generate_form_row_for(f, :skintone) %>
|
||||
<%= generate_form_row_for(f, :bodytype) %>
|
||||
<%= generate_form_row_for(f, :identmarks, 'Identifying marks') %>
|
||||
</div>
|
||||
|
||||
<div class="hidden section social_section">
|
||||
<%= generate_form_row_for(f, :bestfriend, 'Best friend', [{:action => 'character_picker', :icon => 'user'}]) %>
|
||||
<%= generate_form_row_for(f, :religion) %>
|
||||
<%= generate_form_row_for(f, :politics) %>
|
||||
<%= generate_form_row_for(f, :prejudices) %>
|
||||
<%= generate_form_row_for(f, :occupation) %>
|
||||
<%= generate_form_row_for(f, :pets) %>
|
||||
</div>
|
||||
|
||||
<div class="hidden section behavior_section">
|
||||
<%= generate_form_row_for(f, :mannerisms) %>
|
||||
</div>
|
||||
|
||||
<div class="hidden section history_section">
|
||||
<%= generate_form_row_for(f, :birthday) %>
|
||||
<%= generate_form_row_for(f, :birthplace, nil, [{:action => 'location_picker', :icon => 'road'}]) %>
|
||||
<%= generate_form_row_for(f, :education) %>
|
||||
<%= generate_form_row_for(f, :background) %>
|
||||
</div>
|
||||
|
||||
<div class="hidden section favorites_section">
|
||||
<%= generate_form_row_for(f, :fave_color, 'Color') %>
|
||||
<%= generate_form_row_for(f, :fave_food, 'Food') %>
|
||||
<%= generate_form_row_for(f, :fave_possession, 'Possession', [{:action => 'equipment_picker', :icon => 'shopping-cart'}]) %>
|
||||
<%= generate_form_row_for(f, :fave_weapon, 'Weapon', [{:action => 'equipment_picker', :icon => 'shopping-cart'}]) %>
|
||||
<%= generate_form_row_for(f, :fave_animal, 'Animal') %>
|
||||
</div>
|
||||
|
||||
<div class="hidden section relationships_section">
|
||||
<%= generate_form_row_for(f, :father, nil, [{:action => 'character_picker', :icon => 'user'}]) %>
|
||||
<%= generate_form_row_for(f, :mother, nil, [{:action => 'character_picker', :icon => 'user'}]) %>
|
||||
<%= generate_form_row_for(f, :spouse, nil, [{:action => 'character_picker', :icon => 'user'}]) %>
|
||||
<%= generate_form_row_for(f, :siblings, nil, [{:action => 'character_picker', :icon => 'user'}]) %>
|
||||
<%= generate_form_row_for(f, :archenemy, nil, [{:action => 'character_picker', :icon => 'user'}]) %>
|
||||
</div>
|
||||
|
||||
<div class="hidden section notes_section">
|
||||
<div class="control-group">
|
||||
<%= f.label 'Notes', :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_area :notes, :class => 'text_area', :rows => 10, :style => "width: 80%;" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<%= f.label 'Private notes', :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_area :private_notes, :class => 'text_area', :rows => 8, :style => "width: 80%;" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,31 +0,0 @@
|
||||
<% @content.each do |character| %>
|
||||
<div class="col-md-3">
|
||||
<div class="card">
|
||||
<h1 class="card-heading">
|
||||
<%= simple_format link_to character.name, character_path(character) %>
|
||||
</h1>
|
||||
<div class="card-body">
|
||||
<p>
|
||||
<strong>
|
||||
<% if character.role.present? %>
|
||||
<%= character.role %><% if character.age.length > 0 %>, <%= character.age %><% end %>
|
||||
<% end %>
|
||||
</strong>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<div class="card-comments">
|
||||
<p>
|
||||
<% if session[:user] and session[:user] == character.user.id %>
|
||||
<%= link_to t('.view', :default => t("helpers.links.view")),
|
||||
character_path(character), :class => 'btn' %>
|
||||
<%= link_to t('.edit', :default => t("helpers.links.edit")),
|
||||
character_edit_path(character), :class => 'btn' %>
|
||||
<% end %>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@ -1,14 +0,0 @@
|
||||
<ul class="nav nav-stacked">
|
||||
<li class="active tab"><%= link_to "General", "#general", :id => "show_general" %></li>
|
||||
<li class="tab"><%= link_to "Appearance", "#appearance", :id => "show_appearance" %></li>
|
||||
<li class="tab"><%= link_to "Social", "#social", :id => "show_social" %></li>
|
||||
<li class="tab"><%= link_to "Behavior", "#behavior", :id => "show_behavior" %></li>
|
||||
<li class="tab"><%= link_to "History", "#history", :id => "show_history" %></li>
|
||||
<li class="tab"><%= link_to "Favorites", "#favorites", :id => "show_favorites" %></li>
|
||||
<li class="tab"><%= link_to "Relationships", "#relationships", :id => "show_relationships" %></li>
|
||||
<li class="tab"><%= link_to "Notes", "#notes", :id => "show_notes" %></li>
|
||||
<li class="divider"></li>
|
||||
<li class="tab"><a href="#expand-all" class="expand-all">
|
||||
<span class="glyphicon glyphicon-sort-by-attributes-alt"></span> Expand All
|
||||
</a></li>
|
||||
</ul>
|
||||
@ -1,37 +1,9 @@
|
||||
<%- model_class = @content.class -%>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<div class="card">
|
||||
<h1 class="card-heading">Facets</h1>
|
||||
<%= render :partial => 'tabs' %>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h1 class="card-heading">Danger-zone</h1>
|
||||
<div class="card-body">
|
||||
<%= link_to 'Delete character forever', character_path,
|
||||
:class => 'btn btn-danger',
|
||||
<h4>Editing a character</h4>
|
||||
<%= form_for @content, :url => character_edit_process_path do |form| %>
|
||||
<%= render partial: 'content/form', locals: { f: form, content: @content } %>
|
||||
<%= form.submit nil, :class => 'btn btn-primary' %>
|
||||
<%= link_to "Delete #{@content.class.to_s} forever", @content,
|
||||
:class => 'red btn right',
|
||||
:method => :delete,
|
||||
:confirm => 'Are you sure? This action cannot be undone!' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-8">
|
||||
<div class="card">
|
||||
<h1 class="card-heading">Editing <%= @content.name %></h1>
|
||||
<%= form_for @content,
|
||||
:url => character_edit_process_path,
|
||||
:html => { :class => 'form-horizontal' } do |form| %>
|
||||
<div class="card-body">
|
||||
<%= render :partial => 'form', :locals => { :f => form } %>
|
||||
</div>
|
||||
<div class="card-comments">
|
||||
<%= form.submit nil, :class => 'btn btn-primary' %>
|
||||
<%= link_to 'Cancel', character_list_path, :class => 'btn' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@ -1,30 +1,4 @@
|
||||
<div class="row">
|
||||
<h4>You've created <%= @content.count %> characters</h4>
|
||||
<%= render partial: 'content/list/list', locals: { content_list: @content } %>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="card" style="overflow: visible">
|
||||
<h1 class="card-heading simple">
|
||||
Your characters
|
||||
<% if Universe.where(user_id: session[:user]).length > 0 %>
|
||||
<small>from <%= render 'universes/picker' %></small>
|
||||
<% end %>
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render 'content/list/cards', content: @content %>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="card">
|
||||
<h1 class="card-heading">Planning characters</h1>
|
||||
<div class="card-body">
|
||||
<p>
|
||||
Consistency is sometimes hard to keep, and having a reference of everything about your character for yourself can help you down the line, especially if you're writing a series.
|
||||
</p>
|
||||
</div>
|
||||
<div class="card-comments">
|
||||
<%= link_to 'New character', character_create_path, :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<%= link_to 'Create another character', character_create_path, :class => 'btn' %>
|
||||
|
||||
@ -1,29 +1,5 @@
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
|
||||
<div class="card">
|
||||
<h3 class="card-heading simple">New character</h3>
|
||||
<%= render :partial => 'tabs' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="card">
|
||||
|
||||
<%= form_for @content,
|
||||
:url => character_create_process_path,
|
||||
:html => { :class => 'form-horizontal' } do |form| %>
|
||||
|
||||
<div class="card-body">
|
||||
<%= render :partial => 'form', :locals => { :f => form } %>
|
||||
</div>
|
||||
<div class="card-comments">
|
||||
<%= form.submit nil, :class => 'btn btn-primary' %>
|
||||
<%= link_to 'Cancel', character_list_path, :class => 'btn' %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<h4>Create a new character</h4>
|
||||
<%= form_for @content, :url => character_create_process_path do |form| %>
|
||||
<%= render partial: 'content/form', locals: { f: form, content: @content } %>
|
||||
<%= form.submit nil, :class => 'btn btn-primary' %>
|
||||
<% end %>
|
||||
@ -1,100 +1,3 @@
|
||||
<% @character = @content %>
|
||||
<%- model_class = @character.class -%>
|
||||
<%= render partial: 'content/show', locals: { content: @content } %>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<div class="card">
|
||||
<%= render :partial => 'tabs' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-9">
|
||||
<div class="card">
|
||||
<h1 class="card-heading">
|
||||
<%= @character.name %>
|
||||
</h1>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<dl class="dl-horizontal hidden section general_section">
|
||||
<%= print_property("Name", @character.name) %>
|
||||
<%= print_property("Role in story", @character.role) %>
|
||||
<%= print_property("Gender", @character.gender) %>
|
||||
<%= print_property("Age", @character.age) %>
|
||||
<%= print_property("Universe", @character.universe ? @character.universe.name : "", "universe") %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section appearance_section">
|
||||
<%= print_property("Weight", @character.weight) %>
|
||||
<%= print_property("Height", @character.height) %>
|
||||
<%= print_property("Haircolor", @character.haircolor) %>
|
||||
<%= print_property("Hairstyle", @character.hairstyle) %>
|
||||
<%= print_property("Facial hair", @character.facialhair) %>
|
||||
<%= print_property("Eyecolor", @character.eyecolor) %>
|
||||
<%= print_property("Race", @character.race) %>
|
||||
<%= print_property("Skintone", @character.skintone) %>
|
||||
<%= print_property("Body type", @character.bodytype) %>
|
||||
<%= print_property("Identifying marks", @character.identmarks) %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section social_section">
|
||||
<%= print_property("Best friend", @character.bestfriend, "character") %>
|
||||
<%= print_property("Religion", @character.religion) %>
|
||||
<%= print_property("Politics", @character.politics) %>
|
||||
<%= print_property("Prejudices", @character.prejudices) %>
|
||||
<%= print_property("Occupation", @character.occupation) %>
|
||||
<%= print_property("Pets", @character.pets) %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section behavior_section">
|
||||
<%= print_property("Mannerisms", @character.mannerisms) %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section history_section">
|
||||
<%= print_property("Birthday", @character.birthday) %>
|
||||
<%= print_property("Birthplace", @character.birthplace, "location") %>
|
||||
<%= print_property("Education", @character.education, "location") %>
|
||||
<%= print_property("Background", @character.background) %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section favorites_section">
|
||||
<%= print_property("Color", @character.fave_color) %>
|
||||
<%= print_property("Food", @character.fave_food, "equipment") %>
|
||||
<%= print_property("Possession", @character.fave_possession, "equipment") %>
|
||||
<%= print_property("Weapon", @character.fave_weapon, "equipment") %>
|
||||
<%= print_property("Animal", @character.fave_animal, "character") %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section relationships_section">
|
||||
<%= print_property("Father", @character.father, "character") %>
|
||||
<%= print_property("Mother", @character.mother, "character") %>
|
||||
<%= print_property("Spouse", @character.spouse, "character") %>
|
||||
<%= print_property("Siblings", @character.siblings, "character") %>
|
||||
<%= print_property("Archenemy", @character.archenemy, "character") %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section notes_section">
|
||||
<%= print_property("Notes", @character.notes) %>
|
||||
<% if session[:user] and session[:user] == @character.user.id %>
|
||||
<%= print_property("Private notes", @character.private_notes) %>
|
||||
<% end %>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card-comments">
|
||||
|
||||
<% if session[:user] and session[:user] == @character.user.id %>
|
||||
<div class="form-actions">
|
||||
<%= link_to t('.back', :default => t("helpers.links.back")),
|
||||
character_list_path, :class => 'btn' %>
|
||||
<%= link_to t('.edit', :default => t("helpers.links.edit")),
|
||||
character_edit_path(@character), :class => 'btn' %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%= link_to 'Edit this character', edit_character_path(@content), class: 'btn' %>
|
||||
47
app/views/content/_form.html.erb
Normal file
@ -0,0 +1,47 @@
|
||||
<ul class="collapsible popout" data-collapsible="accordion">
|
||||
<% @content.class.attribute_categories.each do |category, data| %>
|
||||
<li>
|
||||
<div class="collapsible-header <%= 'active' if category == @content.class.attribute_categories.first.first %>">
|
||||
<i class="material-icons"><%= data[:icon] %></i>
|
||||
<%= category.to_s.humanize.capitalize %>
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<table class="highlight">
|
||||
<% data[:attributes].each do |attribute| %>
|
||||
<% if attribute == 'universe_id' %>
|
||||
<div class="input-field col s12">
|
||||
<%= f.select attribute, current_user.universes.map(&:name), include_blank: true %>
|
||||
<label for="<%= attribute %>"><%= attribute.humanize.capitalize %></label>
|
||||
</div>
|
||||
<% elsif attribute == 'bestfriend' %>
|
||||
<div class="input-field col s12">
|
||||
<%= f.select attribute, current_user.characters.map(&:name), include_blank: true %>
|
||||
<label for="<%= attribute %>"><%= attribute.humanize.capitalize %></label>
|
||||
</div>
|
||||
<% elsif attribute == 'archenemy' %>
|
||||
<div class="input-field col s12">
|
||||
<%= f.select attribute, current_user.characters.map(&:name), include_blank: true %>
|
||||
<label for="<%= attribute %>"><%= attribute.humanize.capitalize %></label>
|
||||
</div>
|
||||
<% elsif attribute == 'birthplace' %>
|
||||
<div class="input-field col s12">
|
||||
<%= f.select attribute, current_user.locations.map(&:name), include_blank: true %>
|
||||
<label for="<%= attribute %>"><%= attribute.humanize.capitalize %></label>
|
||||
</div>
|
||||
<% elsif attribute == 'fave_possession' %>
|
||||
<div class="input-field col s12">
|
||||
<%= f.select attribute, current_user.items.map(&:name), include_blank: true %>
|
||||
<label for="<%= attribute %>"><%= attribute.humanize.capitalize %></label>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="input-field col s12">
|
||||
<%= f.text_field attribute %>
|
||||
<label for="<%= attribute %>"><%= attribute.humanize.capitalize %></label>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
26
app/views/content/_show.html.erb
Normal file
@ -0,0 +1,26 @@
|
||||
<% content_for :sidebar_top do %>
|
||||
<%= render partial: 'cards/serendipitous/content_question', locals: { question: @question, content: @content } %>
|
||||
<% end %>
|
||||
|
||||
<h4><%= content.name %></h4>
|
||||
<ul class="collapsible popout" data-collapsible="accordion">
|
||||
|
||||
<% content.class.attribute_categories.each do |category, data| %>
|
||||
<li>
|
||||
<div class="collapsible-header <%= 'active' if category == content.class.attribute_categories.first.first %>">
|
||||
<i class="material-icons"><%= data[:icon] %></i>
|
||||
<%= category.to_s.humanize.capitalize %>
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
<table class="highlight">
|
||||
<% data[:attributes].each do |attribute| %>
|
||||
<tr>
|
||||
<td><%= attribute.humanize.capitalize %></td>
|
||||
<td><%= content.send attribute %></td>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
@ -1,26 +0,0 @@
|
||||
<% content.each do |content| %>
|
||||
<div class="col-md-3">
|
||||
<div class="card">
|
||||
<h1 class="card-heading">
|
||||
<%= simple_format link_to content.card_title, content %>
|
||||
</h1>
|
||||
<div class="card-body">
|
||||
<p>
|
||||
<strong>
|
||||
<%= content.card_subtitle %>
|
||||
</strong>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
</div>
|
||||
<div class="card-comments">
|
||||
<p>
|
||||
<% if session[:user] and session[:user] == content.user.id %>
|
||||
<%= link_to t('.view', :default => t("helpers.links.view")), content, :class => 'btn' %>
|
||||
<%= link_to t('.edit', :default => t("helpers.links.edit")), content, :class => 'btn' %>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
22
app/views/content/list/_list.html.erb
Normal file
@ -0,0 +1,22 @@
|
||||
<ul class="collection <%= 'with-header' if local_assigns[:title] %> hoverable">
|
||||
<% if local_assigns[:title] %>
|
||||
<li class="collection-header"><h4><%= title %></h4></li>
|
||||
<% end %>
|
||||
<% content_list.each do |content| %>
|
||||
<li class="collection-item avatar">
|
||||
<i class="material-icons circle <%= content.class.color %>"><%= content.class.icon %></i>
|
||||
<span class="title"><%= link_to content.name, content %></span>
|
||||
<p class="truncate">
|
||||
<%= content.description %>
|
||||
</p>
|
||||
<p class='grey-text'>
|
||||
<em>last edited <%= content.updated_at.strftime("%m/%d/%Y") %></em>
|
||||
</p>
|
||||
<span class="secondary-content">
|
||||
<%= link_to edit_polymorphic_path(content) do %>
|
||||
<i class="material-icons">edit</i>
|
||||
<% end %>
|
||||
</span>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
@ -1,28 +0,0 @@
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<% @content.first.table_columns.keys.each do |column_header| %>
|
||||
<th><%= column_header %></th>
|
||||
<% end %>
|
||||
<% if session[:user] %>
|
||||
<th><%=t '.actions', :default => t("helpers.actions") %></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @content.each do |row_item| %>
|
||||
<tr>
|
||||
<% row_item.table_columns.values.each do |cell| %>
|
||||
<td><%= cell.is_a? Proc ? cell.call : cell %></td>
|
||||
<% end %>
|
||||
<td style="width: 240px;">
|
||||
<% if session[:user] and session[:user] == row_item.user.id %>
|
||||
<%= link_to t('.view', :default => t("helpers.links.view")), equipment_path(row_item), :class => 'btn' %>
|
||||
<%= link_to t('.edit', :default => t("helpers.links.edit")), equipment_edit_path(row_item), :class => 'btn' %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
16
app/views/devise/confirmations/new.html.erb
Normal file
@ -0,0 +1,16 @@
|
||||
<h2>Resend confirmation instructions</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Resend confirmation instructions" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
@ -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
app/views/devise/mailer/password_change.html.erb
Normal file
@ -0,0 +1,3 @@
|
||||
<p>Hello <%= @resource.email %>!</p>
|
||||
|
||||
<p>We're contacting you to notify you that your password has been changed.</p>
|
||||
@ -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
app/views/devise/mailer/unlock_instructions.html.erb
Normal file
@ -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>
|
||||
25
app/views/devise/passwords/edit.html.erb
Normal file
@ -0,0 +1,25 @@
|
||||
<h2>Change your password</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<%= f.hidden_field :reset_password_token %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password, "New password" %><br />
|
||||
<% if @minimum_password_length %>
|
||||
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
|
||||
<% end %>
|
||||
<%= f.password_field :password, autofocus: true, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation, "Confirm new password" %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Change my password" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
16
app/views/devise/passwords/new.html.erb
Normal file
@ -0,0 +1,16 @@
|
||||
<h2>Forgot your password?</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 :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Send me reset password instructions" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
35
app/views/devise/registrations/edit.html.erb
Normal file
@ -0,0 +1,35 @@
|
||||
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
</div>
|
||||
|
||||
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
||||
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
||||
<%= f.password_field :password, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
||||
<%= f.password_field :current_password, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Update", class: 'btn' %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= link_to "Back", :back %>
|
||||
29
app/views/devise/registrations/new.html.erb
Normal file
@ -0,0 +1,29 @@
|
||||
<h2>Sign up</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password %>
|
||||
<% if @minimum_password_length %>
|
||||
<em>(<%= @minimum_password_length %> characters minimum)</em>
|
||||
<% end %><br />
|
||||
<%= f.password_field :password, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Sign up", class: 'btn' %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
26
app/views/devise/sessions/new.html.erb
Normal file
@ -0,0 +1,26 @@
|
||||
<h2>Log in</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password %><br />
|
||||
<%= f.password_field :password, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<% if devise_mapping.rememberable? -%>
|
||||
<div class="field">
|
||||
<%= f.check_box :remember_me %>
|
||||
<%= f.label :remember_me %>
|
||||
</div>
|
||||
<% end -%>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Log in", class: 'btn' %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
25
app/views/devise/shared/_links.html.erb
Normal file
@ -0,0 +1,25 @@
|
||||
<%- if controller_name != 'sessions' %>
|
||||
<%= link_to "Log in", new_session_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
||||
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
||||
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
||||
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
||||
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.omniauthable? %>
|
||||
<%- resource_class.omniauth_providers.each do |provider| %>
|
||||
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
16
app/views/devise/unlocks/new.html.erb
Normal file
@ -0,0 +1,16 @@
|
||||
<h2>Resend unlock instructions</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Resend unlock instructions" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
||||
@ -1,37 +0,0 @@
|
||||
<div class="hidden section starter_section general_section">
|
||||
<%= generate_form_row_for(f, :name, nil) %>
|
||||
<%= generate_form_row_for(f, :equip_type, 'Type') %>
|
||||
<%= generate_form_row_for(f, :description, nil) %>
|
||||
<%= generate_form_row_for(f, :universe, nil, [{:action => 'universe_picker', :icon => 'globe'}]) %>
|
||||
</div>
|
||||
|
||||
<div class="hidden section appearance_section">
|
||||
<%= generate_form_row_for(f, :weight, nil) %>
|
||||
</div>
|
||||
|
||||
<div class="hidden section history_section">
|
||||
<%= generate_form_row_for(f, :original_owner, nil, [{:action => 'character_picker', :icon => 'user'}]) %>
|
||||
<%= generate_form_row_for(f, :current_owner, nil, [{:action => 'character_picker', :icon => 'user'}]) %>
|
||||
<%= generate_form_row_for(f, :made_by, nil, [{:action => 'character_picker', :icon => 'user'}]) %>
|
||||
<%= generate_form_row_for(f, :materials, nil) %>
|
||||
<%= generate_form_row_for(f, :year_made, nil) %>
|
||||
</div>
|
||||
|
||||
<div class="hidden section abilities_section">
|
||||
<%= generate_form_row_for(f, :magic, nil) %>
|
||||
</div>
|
||||
|
||||
<div class="hidden section notes_section">
|
||||
<div class="control-group">
|
||||
<%= f.label 'Notes', :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_area :notes, :class => 'text_area', :rows => 10, :style => "width: 80%;" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<%= f.label 'Private notes', :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_area :private_notes, :class => 'text_area', :rows => 8, :style => "width: 80%;" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,11 +0,0 @@
|
||||
<ul class="nav nav-stacked">
|
||||
<li class="active tab"><%= link_to "General", "#general", :id => "show_general" %></li>
|
||||
<li class="tab"><%= link_to "Appearance", "#appearance", :id => "show_appearance" %></li>
|
||||
<li class="tab"><%= link_to "History", "#history", :id => "show_history" %></li>
|
||||
<li class="tab"><%= link_to "Abilities", "#abilities", :id => "show_abilities" %></li>
|
||||
<li class="tab"><%= link_to "Notes", "#notes", :id => "show_notes" %></li>
|
||||
<li class="divider"></li>
|
||||
<li class="tab"><a href="#expand-all" class="expand-all">
|
||||
<span class="glyphicon glyphicon-sort-by-attributes-alt"></span> Expand All
|
||||
</a></li>
|
||||
</ul>
|
||||
@ -1,37 +0,0 @@
|
||||
<%- model_class = @content.class -%>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<div class="card">
|
||||
<h1 class="card-heading">Facets</h1>
|
||||
<%= render :partial => 'tabs' %>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h1 class="card-heading">Danger-zone</h1>
|
||||
<div class="card-body">
|
||||
<%= link_to 'Delete this equipment forever', equipment_path,
|
||||
:class => 'btn btn-danger',
|
||||
:method => :delete,
|
||||
:confirm => 'Are you sure? This action cannot be undone!' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-8">
|
||||
<div class="card">
|
||||
<h1 class="card-heading">Editing <%= @content.name %></h1>
|
||||
<%= form_for @content,
|
||||
:url => equipment_edit_process_path,
|
||||
:html => { :class => 'form-horizontal' } do |form| %>
|
||||
<div class="card-body">
|
||||
<%= render :partial => 'form', :locals => { :f => form } %>
|
||||
</div>
|
||||
<div class="card-comments">
|
||||
<%= form.submit nil, :class => 'btn btn-primary' %>
|
||||
<%= link_to 'Cancel', equipment_list_path, :class => 'btn' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,25 +0,0 @@
|
||||
<% if @content.length > 0 %>
|
||||
<div class="card">
|
||||
<h3 class="card-heading simple">
|
||||
Your equipment
|
||||
<% if false and Universe.where(user_id: session[:user]).length > 0 %>
|
||||
<small>from <%= render 'universes/picker' %></small>
|
||||
<% end %>
|
||||
</h3>
|
||||
|
||||
<%= render 'content/list/table', content: @content %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="card">
|
||||
<h3 class="card-heading simple">Planning equipment</h3>
|
||||
<div class="card-body">
|
||||
<p>
|
||||
A legendary sword or decrepit family shield are capable of telling a story all on their own. Before including them in your literary masterpiece, you should flesh their history out and keep their stories straight.
|
||||
</p>
|
||||
<%= link_to 'New Equipment', equipment_create_path, :class => 'btn btn-primary' %>
|
||||
<%= link_to 'New Weapon', equipment_create_type_path(:weapon), :class => 'btn' %>
|
||||
<%= link_to 'New Armor', equipment_create_type_path(:armor), :class => 'btn' %>
|
||||
</div>
|
||||
<div class="card-comments"></div>
|
||||
</div>
|
||||
@ -1,31 +0,0 @@
|
||||
<%- model_class = @content.class -%>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
|
||||
<div class="card">
|
||||
<h3 class="card-heading simple">New equipment</h3>
|
||||
<%= render :partial => 'tabs' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="card">
|
||||
|
||||
<%= form_for @content,
|
||||
:url => equipment_create_process_path,
|
||||
:html => { :class => 'form-horizontal' } do |form| %>
|
||||
|
||||
<div class="card-body">
|
||||
<%= render :partial => 'form', :locals => { :f => form } %>
|
||||
</div>
|
||||
<div class="card-comments">
|
||||
<%= form.submit nil, :class => 'btn btn-primary' %>
|
||||
<%= link_to 'Cancel', equipment_list_path, :class => 'btn' %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -1,64 +0,0 @@
|
||||
<% @equipment = @content %>
|
||||
<%- model_class = @equipment.class -%>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<div class="card">
|
||||
<%= render :partial => 'tabs' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-9">
|
||||
<div class="card">
|
||||
<h1 class="card-heading">
|
||||
<%= @equipment.name %>
|
||||
</h1>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<dl class="dl-horizontal hidden section general_section">
|
||||
<%= print_property("Name", @equipment.name, "") %>
|
||||
<%= print_property("Type", @equipment.equip_type, "") %>
|
||||
<%= print_property("Description", @equipment.description, "") %>
|
||||
<%= print_property("Universe", @equipment.universe ? @equipment.universe.name : "", "universe") %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section appearance_section">
|
||||
<%= print_property("Weight", @equipment.weight, "") %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section history_section">
|
||||
<%= print_property("Original owner", @equipment.original_owner, "character") %>
|
||||
<%= print_property("Current owner", @equipment.current_owner, "character") %>
|
||||
<%= print_property("Made by", @equipment.made_by, "character") %>
|
||||
<%= print_property("Materials used", @equipment.materials, "equipment") %>
|
||||
<%= print_property("Year made", @equipment.year_made, "") %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section abilities_section">
|
||||
<%= print_property("Magical properties", @equipment.magic, "") %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section notes_section">
|
||||
<%= print_property("Notes", @equipment.notes, "") %>
|
||||
<% if session[:user] and session[:user] == @equipment.user.id %>
|
||||
<%= print_property("Private notes", @equipment.private_notes, "") %>
|
||||
<% end %>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card-comments">
|
||||
<% if session[:user] and session[:user] == @equipment.user.id %>
|
||||
<div class="form-actions">
|
||||
<%= link_to t('.back', :default => t("helpers.links.back")),
|
||||
equipment_list_path, :class => 'btn' %>
|
||||
<%= link_to t('.edit', :default => t("helpers.links.edit")),
|
||||
equipment_edit_path(@equipment), :class => 'btn' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -13,7 +13,7 @@
|
||||
<% @content.each do |equipment| %>
|
||||
<tr>
|
||||
<td style="width: 160px;"><%= simple_format link_to equipment.name, equipment_path(equipment) %></td>
|
||||
<td><%= simple_format equipment.equip_type %></td>
|
||||
<td><%= simple_format equipment.item_type %></td>
|
||||
<td><%= simple_format equipment.description %></td>
|
||||
<td style="width: 240px;">
|
||||
<% if session[:user] and session[:user] == equipment.user.id %>
|
||||
9
app/views/items/edit.html.erb
Normal file
@ -0,0 +1,9 @@
|
||||
<h4>Editing an item</h4>
|
||||
<%= form_for @content, :url => item_edit_process_path do |form| %>
|
||||
<%= render partial: 'content/form', locals: { f: form, content: @content } %>
|
||||
<%= form.submit nil, :class => 'btn btn-primary' %>
|
||||
<%= link_to "Delete #{@content.class.to_s} forever", @content,
|
||||
:class => 'red btn right',
|
||||
:method => :delete,
|
||||
:confirm => 'Are you sure? This action cannot be undone!' %>
|
||||
<% end %>
|
||||
4
app/views/items/index.html.erb
Normal file
@ -0,0 +1,4 @@
|
||||
<h4>You've created <%= @content.count %> items</h4>
|
||||
<%= render partial: 'content/list/list', locals: { content_list: @content } %>
|
||||
|
||||
<%= link_to 'Create another item', item_create_path, :class => 'btn' %>
|
||||
5
app/views/items/new.html.erb
Normal file
@ -0,0 +1,5 @@
|
||||
<h4>Create a new item</h4>
|
||||
<%= form_for @content, :url => item_create_process_path do |form| %>
|
||||
<%= render partial: 'content/form', locals: { f: form, content: @content } %>
|
||||
<%= form.submit nil, :class => 'btn btn-primary' %>
|
||||
<% end %>
|
||||
3
app/views/items/show.html.erb
Normal file
@ -0,0 +1,3 @@
|
||||
<%= render partial: 'content/show', locals: { content: @content } %>
|
||||
|
||||
<%= link_to 'Edit this item', edit_item_path(@content), class: 'btn' %>
|
||||
@ -1,32 +0,0 @@
|
||||
<div class="hidden section starter_section general_section">
|
||||
<%= generate_form_row_for(f, :name, nil) %>
|
||||
<%= generate_form_row_for(f, :universe, nil, [{:action => 'universe_picker', :icon => 'globe'}]) %>
|
||||
</div>
|
||||
|
||||
<div class="hidden section vocabulary_section">
|
||||
<div class="control-group">
|
||||
<%= f.label 'Words', :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_area :words, :class => 'text_field', :rows => 6 %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hidden section history_section">
|
||||
<%= generate_form_row_for(f, :established_year, nil) %>
|
||||
<%= generate_form_row_for(f, :established_location, 'Established in', [{:action => 'location_picker', :icon => 'globe'}]) %>
|
||||
</div>
|
||||
|
||||
<div class="hidden section speakers_section">
|
||||
<%= generate_form_row_for(f, :characters, nil, [{:action => 'character_picker', :icon => 'user'}]) %>
|
||||
<%= generate_form_row_for(f, :locations, nil, [{:action => 'location_picker', :icon => 'globe'}]) %>
|
||||
</div>
|
||||
|
||||
<div class="hidden section more_section">
|
||||
<div class="control-group">
|
||||
<%= f.label 'Notes', :class => 'control-label' %>
|
||||
<div class="controls">
|
||||
<%= f.text_area :notes, :class => 'text_area', :rows => 12, :style => "width: 80%;" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,26 +0,0 @@
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<% if session[:user] %>
|
||||
<th><%=t '.actions', :default => t("helpers.actions") %></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @content.each do |language| %>
|
||||
<tr>
|
||||
<td style="width: 160px;"><%= simple_format link_to language.name, language_path(language) %></td>
|
||||
<td style="width: 180px;">
|
||||
<% if session[:user] and session[:user] == language.user.id %>
|
||||
<%= link_to t('.view', :default => t("helpers.links.view")),
|
||||
language_path(language), :class => 'btn' %>
|
||||
<%= link_to t('.edit', :default => t("helpers.links.edit")),
|
||||
language_edit_path(language), :class => 'btn' %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
<ul class="nav nav-stacked">
|
||||
<li class="active tab"><%= link_to "General", "#general", :id => "show_general" %></li>
|
||||
<li class="tab"><%= link_to "Vocabulary", "#vocabulary", :id => "show_vocabulary" %></li>
|
||||
<li class="tab"><%= link_to "History", "#history", :id => "show_history" %></li>
|
||||
<li class="tab"><%= link_to "Speakers", "#speakers", :id => "show_speakers" %></li>
|
||||
<li class="tab"><%= link_to "More...", "#more", :id => "show_more" %></li>
|
||||
<li class="divider"></li>
|
||||
<li class="tab"><a href="#expand-all" class="expand-all">
|
||||
<span class="glyphicon glyphicon-sort-by-attributes-alt"></span> Expand All
|
||||
</a></li>
|
||||
</ul>
|
||||
@ -1,37 +0,0 @@
|
||||
<%- model_class = @content.class -%>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<div class="card">
|
||||
<h1 class="card-heading">Facets</h1>
|
||||
<%= render :partial => 'tabs' %>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h1 class="card-heading">Danger-zone</h1>
|
||||
<div class="card-body">
|
||||
<%= link_to 'Delete this language forever', language_path,
|
||||
:class => 'btn btn-danger',
|
||||
:method => :delete,
|
||||
:confirm => 'Are you sure? This action cannot be undone!' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-8">
|
||||
<div class="card">
|
||||
<h1 class="card-heading">Editing <%= @content.name %></h1>
|
||||
<%= form_for @content,
|
||||
:url => language_edit_process_path,
|
||||
:html => { :class => 'form-horizontal' } do |form| %>
|
||||
<div class="card-body">
|
||||
<%= render :partial => 'form', :locals => { :f => form } %>
|
||||
</div>
|
||||
<div class="card-comments">
|
||||
<%= form.submit nil, :class => 'btn btn-primary' %>
|
||||
<%= link_to 'Cancel', language_list_path, :class => 'btn' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,24 +0,0 @@
|
||||
<%- model_class = @content.class -%>
|
||||
<% if @content.length > 0 %>
|
||||
<div class="card">
|
||||
<h3 class="card-heading simple">
|
||||
Languages
|
||||
<% if false and Universe.where(user_id: session[:user]).length > 0 %>
|
||||
<small>spoken in <%= render 'universes/picker' %></small>
|
||||
<% end %>
|
||||
</h3>
|
||||
|
||||
<%= render 'list' %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="card">
|
||||
<h3 class="card-heading simple">Planning languages</h3>
|
||||
<div class="card-body">
|
||||
<p>
|
||||
English doesn't have to be the only language in your story. Whether you're planning differing dialects or completely new languages, you want to keep track of what defines them.
|
||||
</p>
|
||||
<%= link_to 'New language', language_create_path, :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
<div class="card-comments"></div>
|
||||
</div>
|
||||
@ -1,30 +0,0 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
|
||||
<div class="card">
|
||||
<h3 class="card-heading simple">New language</h3>
|
||||
<%= render :partial => 'tabs' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="card">
|
||||
|
||||
<%= form_for @content,
|
||||
:url => language_create_process_path,
|
||||
:html => { :class => 'form-horizontal' } do |form| %>
|
||||
|
||||
<div class="card-body">
|
||||
<%= render :partial => 'form', :locals => { :f => form } %>
|
||||
</div>
|
||||
<div class="card-comments">
|
||||
<%= form.submit nil, :class => 'btn btn-primary' %>
|
||||
<%= link_to 'Cancel', language_list_path, :class => 'btn' %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -1,59 +0,0 @@
|
||||
<% @language = @content %>
|
||||
<%- model_class = @language.class -%>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<div class="card">
|
||||
<%= render :partial => 'tabs' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-9">
|
||||
<div class="card">
|
||||
<h1 class="card-heading">
|
||||
<%= @language.name %>
|
||||
</h1>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<dl class="dl-horizontal hidden section general_section">
|
||||
<%= print_property("Name", @language.name, "") %>
|
||||
<%= print_property("Universe", @language.universe ? @language.universe.name : "", "universe") %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section vocabulary_section">
|
||||
<%= print_property("Words", @language.words, "") %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section history_section">
|
||||
<%= print_property("Established year", @language.established_year, "") %>
|
||||
<%= print_property("Established location", @language.established_location, "location") %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section speakers_section">
|
||||
<%= print_property("Fluent characters", @language.characters, "") %>
|
||||
<%= print_property("Locations spoken", @language.locations, "") %>
|
||||
</dl>
|
||||
|
||||
<dl class="dl-horizontal hidden section more_section">
|
||||
<%= print_property("Notes", @language.notes, "") %>
|
||||
</dl>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card-comments">
|
||||
|
||||
<% if session[:user] and session[:user] == @language.user.id %>
|
||||
<div class="form-actions">
|
||||
<%= link_to t('.back', :default => t("helpers.links.back")),
|
||||
language_list_path, :class => 'btn' %>
|
||||
<%= link_to t('.edit', :default => t("helpers.links.edit")),
|
||||
language_edit_path(@language), :class => 'btn' %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,2 +0,0 @@
|
||||
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
|
||||
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
|
||||
33
app/views/layouts/_footer.html.erb
Normal file
@ -0,0 +1,33 @@
|
||||
<footer class="page-footer light-blue">
|
||||
|
||||
<% if user_signed_in? %>
|
||||
<div class="fixed-action-btn horizontal" style="bottom: 25px; right: 24px;">
|
||||
<a class="btn-floating btn-large blue-grey">
|
||||
<i class="large material-icons">add</i>
|
||||
</a>
|
||||
<ul>
|
||||
<li><a href="<%= universe_create_url %>" class="btn-floating purple"><i class="material-icons">vpn_lock</i></a></li>
|
||||
<li><a href="<%= character_create_url %>" class="btn-floating red"><i class="material-icons">group</i></a></li>
|
||||
<li><a href="<%= location_create_url %>" class="btn-floating green"><i class="material-icons">terrain</i></a></li>
|
||||
<li><a href="<%= item_create_url %>" class="btn-floating amber"><i class="material-icons">beach_access</i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<div class="grey-text">
|
||||
<a href="/about/attribution" class="white-text">Image Attribution</a> /
|
||||
<a href="/about/privacy" class="white-text">Privacy Policy</a> /
|
||||
<a href="https://github.com/drusepth/Indent" class="white-text">Source Code</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer-copyright">
|
||||
<div class="container">
|
||||
© 2016 <%= link_to 'Indent Labs, LLC.', 'http://indentlabs.com', class: 'white-text' %>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
@ -1,12 +1,12 @@
|
||||
<ul class="nav navbar-nav">
|
||||
<% if session[:user] %>
|
||||
<% if user_signed_in? %>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="glyphicon glyphicon-user"></span>
|
||||
<b class="caret"></b>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/account">Logged in as <%= User.find(session[:user]).name %></a></li>
|
||||
<li><a href="/account">Logged in as <%= current_user.email %></a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="/my/content">My Content</a></li>
|
||||
<li><a href="/account">Account Settings</a></li>
|
||||
@ -17,11 +17,11 @@
|
||||
<li><a href="https://docs.google.com/forms/d/11O6mHMIFFbNiUfdj6eqStXnARPcj3tWnYOQ-90QktDk/viewform" target="_blank">Give feedback</a></li>
|
||||
<li><a href="https://docs.google.com/forms/d/1ncA82di103_e3KjG8PCHO9g9RQY0_89I6mSQf2L0S4g/viewform" target="_blank">Request a feature</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="/logout">Log out</a></li>
|
||||
<li><%= link_to 'Log out', destroy_user_session_path, :method => :delete %></li>
|
||||
</ul>
|
||||
</li>
|
||||
<% else %>
|
||||
<li><a href="/login">Login</a></li>
|
||||
<li><a href="/register">Register</a></li>
|
||||
<li><%= link_to 'Sign up', new_user_registration_path %></li>
|
||||
<li><%= link_to 'Log in', new_user_session_path %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
@ -1,29 +1,61 @@
|
||||
<nav class="navbar navbar-fixed-top" role="navigation">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<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="/">Indent</a>
|
||||
</div>
|
||||
<ul id="dropdown1" class="dropdown-content">
|
||||
<li><%= link_to 'Account settings', edit_user_registration_path %></li>
|
||||
<li class="divider"></li>
|
||||
<li><%= link_to "Sign out", destroy_user_session_path, :method => :delete %></li>
|
||||
</ul>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbar-container">
|
||||
<ul class="nav navbar-nav">
|
||||
<% if session[:user] %>
|
||||
<li><a href="/"><span class="glyphicon glyphicon-home"></span></a></li>
|
||||
<% end %>
|
||||
<li><a href="/plan/characters">Characters</a></li>
|
||||
<li class="active"><a href="/plan/equipment">Equipment</a></li>
|
||||
<li><a href="/plan/languages">Languages</a></li>
|
||||
<li><a href="/plan/locations">Locations</a></li>
|
||||
<li><a href="/plan/magic">Magic</a></li>
|
||||
<li><a href="/plan/universes">Universes</a></li>
|
||||
</ul>
|
||||
<div class="navbar-fixed">
|
||||
<nav class="light-blue">
|
||||
<div class="nav-wrapper">
|
||||
<%= link_to 'Notebook', root_url, class: 'brand-logo center' %>
|
||||
|
||||
<div class="navbar-right">
|
||||
<%= render 'layouts/login_box' %>
|
||||
<ul class="right hide-on-small-and-down">
|
||||
<% if user_signed_in? %>
|
||||
<li>
|
||||
<a href="<%= universe_list_url %>" class="tooltipped" data-position="bottom" data-delay="100" data-tooltip="Universes">
|
||||
<i class="material-icons">vpn_lock</i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<%= character_list_url %>" class="tooltipped" data-position="bottom" data-delay="100" data-tooltip="Characters">
|
||||
<i class="material-icons">group</i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<%= location_list_url %>" class="tooltipped" data-position="bottom" data-delay="100" data-tooltip="Locations">
|
||||
<i class="material-icons">terrain</i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<%= item_list_url %>" class="tooltipped" data-position="bottom" data-delay="100" data-tooltip="Items">
|
||||
<i class="material-icons">beach_access</i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-button tooltipped" href="#!" data-activates="dropdown1" data-position="bottom" data-delay="100" data-tooltip="You">
|
||||
<i class="material-icons">person</i>
|
||||
</a>
|
||||
</li>
|
||||
<% else %>
|
||||
<li><%= link_to 'Sign in', new_user_session_path %></li>
|
||||
<li><%= link_to 'Sign up', new_user_registration_path %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<ul class="left hide-on-med-and-down">
|
||||
<li>
|
||||
<%= link_to root_url do %>
|
||||
<i class="material-icons">home</i>
|
||||
<% end %>
|
||||
<li>
|
||||
<form>
|
||||
<div class="input-field">
|
||||
<input id="search" type="search" required>
|
||||
<label for="search"><i class="material-icons">search</i></label>
|
||||
<i class="material-icons">close</i>
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</nav>
|
||||
</div>
|
||||
@ -1,7 +0,0 @@
|
||||
<noscript>
|
||||
<div class="navbar" style="padding: 12px; margin-top: -20px; background: #ff2211; border-bottom: 1px solid #ffbbaa; text-align: center; text: black;">
|
||||
<div class="container">
|
||||
Please enable Javascript for the site to function correctly. We promise not to do anything bad!
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||