Skip to content

Commit

Permalink
added moves scaffold and integrated custom mstar webfont
Browse files Browse the repository at this point in the history
  • Loading branch information
prusswan committed Dec 21, 2012
1 parent 9f255c8 commit 4575d6e
Show file tree
Hide file tree
Showing 29 changed files with 1,123 additions and 0 deletions.
Binary file added app/assets/fonts/Mstar.eot
Binary file not shown.
Binary file added app/assets/fonts/Mstar.otf
Binary file not shown.
538 changes: 538 additions & 0 deletions app/assets/fonts/Mstar.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/fonts/Mstar.ttf
Binary file not shown.
Binary file added app/assets/fonts/Mstar.woff
Binary file not shown.
3 changes: 3 additions & 0 deletions app/assets/javascripts/moves.js.coffee
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
14 changes: 14 additions & 0 deletions app/assets/stylesheets/fonts.css.scss
@@ -0,0 +1,14 @@
/* Wingdings 3 web font from: http://code.google.com/p/libble/ */
@font-face {
font-family: 'Wingdings 3';
src: url('Mstar.eot');
src: url('Mstar.eot?iefix') format('eot'),
url('Mstar.woff') format('woff'),
url('Mstar.otf') format('opentype'),
url('Mstar.svg') format('svg');
}

.sequence {
font-family: 'Wingdings 3', Verdana, Helvetica, Arial, sans-serif;
font-size: 32px;
}
3 changes: 3 additions & 0 deletions app/assets/stylesheets/moves.css.scss
@@ -0,0 +1,3 @@
// Place all the styles related to the Moves controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
69 changes: 69 additions & 0 deletions app/assets/stylesheets/scaffolds.css.scss
@@ -0,0 +1,69 @@
body {
background-color: #fff;
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}

p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}

pre {
background-color: #eee;
padding: 10px;
font-size: 11px;
}

a {
color: #000;
&:visited {
color: #666;
}
&:hover {
color: #fff;
background-color: #000;
}
}

div {
&.field, &.actions {
margin-bottom: 10px;
}
}

#notice {
color: green;
}

.field_with_errors {
padding: 2px;
background-color: red;
display: table;
}

#error_explanation {
width: 450px;
border: 2px solid red;
padding: 7px;
padding-bottom: 0;
margin-bottom: 20px;
background-color: #f0f0f0;
h2 {
text-align: left;
font-weight: bold;
padding: 5px 5px 5px 15px;
font-size: 12px;
margin: -7px;
margin-bottom: 0px;
background-color: #c00;
color: #fff;
}
ul li {
font-size: 12px;
list-style: square;
}
}
83 changes: 83 additions & 0 deletions app/controllers/moves_controller.rb
@@ -0,0 +1,83 @@
class MovesController < ApplicationController
# GET /moves
# GET /moves.json
def index
@moves = Move.all

respond_to do |format|
format.html # index.html.erb
format.json { render json: @moves }
end
end

# GET /moves/1
# GET /moves/1.json
def show
@move = Move.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.json { render json: @move }
end
end

# GET /moves/new
# GET /moves/new.json
def new
@move = Move.new

respond_to do |format|
format.html # new.html.erb
format.json { render json: @move }
end
end

# GET /moves/1/edit
def edit
@move = Move.find(params[:id])
end

# POST /moves
# POST /moves.json
def create
@move = Move.new(params[:move])

respond_to do |format|
if @move.save
format.html { redirect_to @move, notice: 'Move was successfully created.' }
format.json { render json: @move, status: :created, location: @move }
else
format.html { render action: "new" }
format.json { render json: @move.errors, status: :unprocessable_entity }
end
end
end

# PUT /moves/1
# PUT /moves/1.json
def update
@move = Move.find(params[:id])

respond_to do |format|
if @move.update_attributes(params[:move])
format.html { redirect_to @move, notice: 'Move was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @move.errors, status: :unprocessable_entity }
end
end
end

# DELETE /moves/1
# DELETE /moves/1.json
def destroy
@move = Move.find(params[:id])
@move.destroy

respond_to do |format|
format.html { redirect_to moves_url }
format.json { head :no_content }
end
end
end
2 changes: 2 additions & 0 deletions app/helpers/moves_helper.rb
@@ -0,0 +1,2 @@
module MovesHelper
end
3 changes: 3 additions & 0 deletions app/models/move.rb
@@ -0,0 +1,3 @@
class Move < ActiveRecord::Base
attr_accessible :mstar_id, :sequence
end
16 changes: 16 additions & 0 deletions app/views/moves/_form.html.haml
@@ -0,0 +1,16 @@
= form_for @move do |f|
- if @move.errors.any?
#error_explanation
%h2= "#{pluralize(@move.errors.count, "error")} prohibited this move from being saved:"
%ul
- @move.errors.full_messages.each do |msg|
%li= msg

.field
= f.label :mstar_id
= f.text_field :mstar_id
.field
= f.label :sequence
= f.text_field :sequence, class: 'sequence'
.actions
= f.submit 'Save'
7 changes: 7 additions & 0 deletions app/views/moves/edit.html.haml
@@ -0,0 +1,7 @@
%h1 Editing move

= render 'form'

= link_to 'Show', @move
\|
= link_to 'Back', moves_path
21 changes: 21 additions & 0 deletions app/views/moves/index.html.haml
@@ -0,0 +1,21 @@
%h1 Listing moves

%table
%tr
%th Mstar
%th Sequence
%th
%th
%th

- @moves.each do |move|
%tr
%td= move.mstar_id
%td.sequence= move.sequence
%td= link_to 'Show', move
%td= link_to 'Edit', edit_move_path(move)
%td= link_to 'Destroy', move, method: :delete, data: { confirm: 'Are you sure?' }

%br

= link_to 'New Move', new_move_path
5 changes: 5 additions & 0 deletions app/views/moves/new.html.haml
@@ -0,0 +1,5 @@
%h1 New move

= render 'form'

= link_to 'Back', moves_path
13 changes: 13 additions & 0 deletions app/views/moves/show.html.haml
@@ -0,0 +1,13 @@
%p#notice= notice

%p
%b Mstar:
= @move.mstar_id
%p
%b Sequence:
.sequence
= @move.sequence

= link_to 'Edit', edit_move_path(@move)
\|
= link_to 'Back', moves_path
3 changes: 3 additions & 0 deletions config/routes.rb
@@ -1,4 +1,7 @@
MstarRails::Application.routes.draw do
resources :moves


# The priority is based upon order of creation:
# first created -> highest priority.

Expand Down
10 changes: 10 additions & 0 deletions db/migrate/20121221065617_create_moves.rb
@@ -0,0 +1,10 @@
class CreateMoves < ActiveRecord::Migration
def change
create_table :moves do |t|
t.integer :mstar_id
t.string :sequence

t.timestamps
end
end
end
23 changes: 23 additions & 0 deletions db/schema.rb
@@ -0,0 +1,23 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20121221065617) do

create_table "moves", :force => true do |t|
t.integer "mstar_id"
t.string "sequence"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end

end

0 comments on commit 4575d6e

Please sign in to comment.