From af3c9b52be40f878e7ade7286c803be159ec09da Mon Sep 17 00:00:00 2001 From: Alexey Nayden Date: Wed, 9 Mar 2011 22:27:51 +0300 Subject: [PATCH] Hoptoad + blank platforms#index --- app/controllers/platforms_controller.rb | 46 ++ app/helpers/platforms_helper.rb | 2 + app/models/platform.rb | 2 +- app/views/layouts/application.html.haml | 2 +- app/views/platforms/index.html.haml | 0 config/deploy.rb | 4 +- config/initializers/hoptoad.rb | 3 + db/schema.rb | 18 +- public/stylesheets/compiled/handheld.css | 11 + public/stylesheets/compiled/style.css | 395 ++++++++++++++++++ spec/controllers/platforms_controller_spec.rb | 5 + spec/helpers/platforms_helper_spec.rb | 15 + 12 files changed, 499 insertions(+), 4 deletions(-) create mode 100644 app/controllers/platforms_controller.rb create mode 100644 app/helpers/platforms_helper.rb create mode 100644 app/views/platforms/index.html.haml create mode 100644 config/initializers/hoptoad.rb create mode 100644 public/stylesheets/compiled/handheld.css create mode 100644 public/stylesheets/compiled/style.css create mode 100644 spec/controllers/platforms_controller_spec.rb create mode 100644 spec/helpers/platforms_helper_spec.rb diff --git a/app/controllers/platforms_controller.rb b/app/controllers/platforms_controller.rb new file mode 100644 index 000000000..7a6c127fa --- /dev/null +++ b/app/controllers/platforms_controller.rb @@ -0,0 +1,46 @@ +class PlatformsController < ApplicationController + before_filter :authenticate_user! + + def index + @platforms = Platform.all + end + + def show + @platform = Platform.find params[:id] + end + + def new + @platform = Platform.new + end + + def edit + @platform = Platform.find params[:id] + end + + def create + @platform = Platform.new params[:platform] + if @platform.save + flash[:notice] = 'Платформа успешно добавлена' + redirect_to @platform + else + flash[:error] = 'Не удалось создать платформу' + render :action => :new + end + end + + def update + @platform = Platform.find params[:id] + if @platform.update_attributes(params[:platform]) + flash[:notice] = 'Платформа успешно обновлена' + redirect_to @platform + else + flash[:error] = 'Не удалось обновить платформу' + render :action => :edit + end + end + + def destroy + Platform.destroy params[:id] + redirect_to root_path + end +end diff --git a/app/helpers/platforms_helper.rb b/app/helpers/platforms_helper.rb new file mode 100644 index 000000000..608956faa --- /dev/null +++ b/app/helpers/platforms_helper.rb @@ -0,0 +1,2 @@ +module PlatformsHelper +end diff --git a/app/models/platform.rb b/app/models/platform.rb index 77ae72a0e..547ba312c 100644 --- a/app/models/platform.rb +++ b/app/models/platform.rb @@ -4,7 +4,7 @@ class Platform < ActiveRecord::Base before_validation :generate_unixname validate :validate_unixname - has_many :projects + has_many :projects, :dependent => :destroy has_one :parent, :class_name => 'Platform', :foreign_key => 'parent_platform_id' protected diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index e0dd42851..98de908a9 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -2,7 +2,7 @@ -# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither -ie_html :class => 'no-js' do = render :partial => 'layouts/head' - %body{ :lang => 'en', :class => "#{controller.controller_name}" } + %body{ :lang => 'ru', :class => "#{controller.controller_name}" } #container %header#header = render :partial => 'layouts/header' diff --git a/app/views/platforms/index.html.haml b/app/views/platforms/index.html.haml new file mode 100644 index 000000000..e69de29bb diff --git a/config/deploy.rb b/config/deploy.rb index c5b7b3c2c..38f54fb45 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -19,4 +19,6 @@ role :db, "your slave db-server here" # task :restart, :roles => :app, :except => { :no_release => true } do # run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" # end -# end \ No newline at end of file +# end + require 'config/boot' + require 'hoptoad_notifier/capistrano' diff --git a/config/initializers/hoptoad.rb b/config/initializers/hoptoad.rb new file mode 100644 index 000000000..9854ff710 --- /dev/null +++ b/config/initializers/hoptoad.rb @@ -0,0 +1,3 @@ +HoptoadNotifier.configure do |config| + config.api_key = '935538a0dedb9e56947e27269285299e' +end diff --git a/db/schema.rb b/db/schema.rb index 34ae0c791..d141342fe 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,23 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110309144736) do +ActiveRecord::Schema.define(:version => 20110309173421) do + + create_table "platforms", :force => true do |t| + t.string "name" + t.string "unixname" + t.integer "parent_platform_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "projects", :force => true do |t| + t.string "name" + t.string "unixname" + t.integer "platform_id" + t.datetime "created_at" + t.datetime "updated_at" + end create_table "users", :force => true do |t| t.string "name" diff --git a/public/stylesheets/compiled/handheld.css b/public/stylesheets/compiled/handheld.css new file mode 100644 index 000000000..de1265434 --- /dev/null +++ b/public/stylesheets/compiled/handheld.css @@ -0,0 +1,11 @@ +/* line 1, ../../../app/stylesheets/handheld.scss */ +* { + float: none; + background: #fff; + color: #000; +} + +/* line 8, ../../../app/stylesheets/handheld.scss */ +body { + font-size: 80%; +} diff --git a/public/stylesheets/compiled/style.css b/public/stylesheets/compiled/style.css new file mode 100644 index 000000000..bc44ac786 --- /dev/null +++ b/public/stylesheets/compiled/style.css @@ -0,0 +1,395 @@ +@charset "UTF-8"; +/* line 14, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_reset.scss */ +html, body, div, span, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, +small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, figcaption, figure, +footer, header, hgroup, menu, nav, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} + +/* line 24, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_reset.scss */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} + +/* line 28, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_reset.scss */ +blockquote, q { + quotes: none; +} + +/* line 31, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_reset.scss */ +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} + +/* line 33, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_reset.scss */ +ins { + background-color: #ff9; + color: #000; + text-decoration: none; +} + +/* line 35, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_reset.scss */ +mark { + background-color: #ff9; + color: #000; + font-style: italic; + font-weight: bold; +} + +/* line 37, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_reset.scss */ +del { + text-decoration: line-through; +} + +/* line 39, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_reset.scss */ +abbr[title], dfn[title] { + border-bottom: 1px dotted; + cursor: help; +} + +/* line 41, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_reset.scss */ +table { + border-collapse: collapse; + border-spacing: 0; +} + +/* line 43, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_reset.scss */ +hr { + display: block; + height: 1px; + border: 0; + border-top: 1px solid #ccc; + margin: 1em 0; + padding: 0; +} + +/* line 45, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_reset.scss */ +input, select { + vertical-align: middle; +} + +/* line 11, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_fonts.scss */ +body { + font-size: 13px; + font-family: sans-serif; + line-height: 1.231; + *font-size: small; +} + +/* line 18, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_fonts.scss */ +select, input, textarea, button { + font: 99% sans-serif; +} + +/* line 23, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_fonts.scss */ +pre, code, kbd, samp { + font-family: monospace, sans-serif; +} + +/* line 15, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +html { + overflow-y: scroll; +} + +/* line 17, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +ul, ol { + margin-left: 2em; +} + +/* line 18, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +ol { + list-style-type: decimal; +} + +/* line 20, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +td, td img { + vertical-align: top; +} + +/* line 22, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +sub { + font-size: 75%; + line-height: 0; + position: relative; + bottom: -0.25em; +} + +/* line 24, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +sup { + font-size: 75%; + line-height: 0; + position: relative; + top: -0.5em; +} + +/* line 26, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +textarea { + overflow: auto; +} + +/* line 57, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +a:hover, a:active { + outline: none; +} + +/* line 62, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +pre { + white-space: pre; + white-space: pre-wrap; + white-space: pre-line; + word-wrap: break-word; + padding: 15px; +} + +/* line 71, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +input[type="radio"] { + vertical-align: text-bottom; +} + +/* line 72, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +input[type="checkbox"] { + vertical-align: bottom; +} + +/* line 73, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +.ie7 input[type="checkbox"] { + vertical-align: baseline; +} + +/* line 74, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +.ie6 input { + vertical-align: text-bottom; +} + +/* line 79, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +label, input[type="button"], input[type="submit"], input[type="image"], button { + cursor: pointer; +} + +/* line 84, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +button, input, select, textarea { + margin: 0; +} + +/* line 91, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +::-moz-selection { + background: #ff5e99; + color: white; + text-shadow: none; +} + +/* line 92, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +::selection { + background: #ff5e99; + color: white; + text-shadow: none; +} + +/* line 97, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +a:link { + -webkit-tap-highlight-color: #ff5e99; +} + +/* line 108, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +button { + width: auto; + overflow: visible; +} + +/* line 112, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +.ie7 img { + -ms-interpolation-mode: bicubic; +} + +/* line 114, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +.ie6 legend, .ie7 legend { + margin-left: -7px; +} + +/* line 119, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_styles.scss */ +nav ul, nav li { + margin: 0; + list-style: none; + list-style-image: none; +} + +/* line 10, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_helpers.scss */ +.ir { + text-indent: -119988px; + overflow: hidden; + text-align: left; + direction: ltr; + background-repeat: no-repeat; +} + +/* line 12, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_helpers.scss */ +.hidden { + display: none; + visibility: hidden; +} + +/* line 14, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_helpers.scss */ +.visuallyhidden { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} +/* line 50, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_helpers.scss */ +.visuallyhidden.focusable:active, .visuallyhidden.focusable:focus { + clip: auto; + height: auto; + margin: 0; + overflow: visible; + position: static; + width: auto; +} + +/* line 16, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_helpers.scss */ +.clearfix { + *zoom: 1; +} +/* line 22, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/compass-0.10.6/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss */ +.clearfix:after { + content: "\0020"; + display: block; + height: 0; + clear: both; + overflow: hidden; + visibility: hidden; +} + +/* line 8, ../../../app/stylesheets/partials/_page.scss */ +body, select, input, textarea { + color: #444444; +} + +/* line 15, ../../../app/stylesheets/partials/_page.scss */ +h1, h2, h3, h4, h5, h6 { + font-weight: bold; +} + +/* line 21, ../../../app/stylesheets/partials/_page.scss */ +a, a:active, a:visited { + color: #607890; +} + +/* line 22, ../../../app/stylesheets/partials/_page.scss */ +a:hover { + color: #003366; +} + +/* line 24, ../../../app/stylesheets/partials/_page.scss */ +strong, th { + font-weight: bold; +} + +/* line 28, ../../../app/stylesheets/partials/_page.scss */ +small { + font-size: 85%; +} + +/* line 37, ../../../app/stylesheets/partials/_page.scss */ +input:invalid, textarea:invalid { + -moz-border-radius: 1px; + -webkit-border-radius: 1px; + -o-border-radius: 1px; + -ms-border-radius: 1px; + -khtml-border-radius: 1px; + border-radius: 1px; + -moz-box-shadow: red 0 0 5px 0; + -webkit-box-shadow: red 0 0 5px 0; + -o-box-shadow: red 0 0 5px 0; + box-shadow: red 0 0 5px 0; +} + +/* line 42, ../../../app/stylesheets/partials/_page.scss */ +.no-boxshadow input:invalid, +.no-boxshadow textarea:invalid { + background-color: #f0dddd; +} + +@media print { + /* line 24, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_media.scss */ + * { + background: transparent !important; + color: black !important; + text-shadow: none !important; + filter: none !important; + -ms-filter: none !important; + } + + /* line 26, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_media.scss */ + a, a:visited { + color: #444 !important; + text-decoration: underline; + } + + /* line 27, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_media.scss */ + a[href]:after { + content: " (" attr(href) ")"; + } + + /* line 28, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_media.scss */ + abbr[title]:after { + content: " (" attr(title) ")"; + } + + /* line 29, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_media.scss */ + .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { + content: ""; + } + + /* line 30, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_media.scss */ + pre, blockquote { + border: 1px solid #999; + page-break-inside: avoid; + } + + /* line 31, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_media.scss */ + thead { + display: table-header-group; + } + + /* line 32, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_media.scss */ + tr, img { + page-break-inside: avoid; + } + + @page { + margin: 0.5cm; +} + + /* line 34, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_media.scss */ + p, h2, h3 { + orphans: 3; + widows: 3; + } + + /* line 35, ../../../../../.rvm/gems/ruby-1.8.7-p302/gems/html5-boilerplate-0.3.2/stylesheets/html5-boilerplate/_media.scss */ + h2, h3 { + page-break-after: avoid; + } +} + +@media all and (orientation:portrait) {} +@media all and (orientation:landscape) {} +@media screen and (max-device-width: 480px) {} diff --git a/spec/controllers/platforms_controller_spec.rb b/spec/controllers/platforms_controller_spec.rb new file mode 100644 index 000000000..b90d8ae5f --- /dev/null +++ b/spec/controllers/platforms_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe PlatformsController do + +end diff --git a/spec/helpers/platforms_helper_spec.rb b/spec/helpers/platforms_helper_spec.rb new file mode 100644 index 000000000..c569f8d17 --- /dev/null +++ b/spec/helpers/platforms_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the PlatformsHelper. For example: +# +# describe PlatformsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe PlatformsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end