Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

version 0.0.2

  • Loading branch information...
commit ffd9e9c107f3998b9d45940a9db491eea9148df8 1 parent 3a90032
@jadencarver authored
Showing with 447 additions and 16 deletions.
  1. +2 −0  app/assets/javascripts/superconductor/issues.js
  2. +56 −0 app/assets/stylesheets/scaffold.css
  3. +4 −0 app/assets/stylesheets/superconductor/issues.css
  4. +9 −9 app/assets/stylesheets/superconductor/panel.css.scss
  5. +83 −0 app/controllers/superconductor/issues_controller.rb
  6. +2 −0  app/helpers/superconductor/issues_helper.rb
  7. +2 −2 app/helpers/superconductor/panel_helper.rb
  8. +5 −0 app/models/superconductor.rb
  9. +2 −0  app/models/superconductor/issue.rb
  10. +26 −4 app/views/superconductor/_panel.html.erb
  11. +53 −0 app/views/superconductor/issues/_form.html.erb
  12. +6 −0 app/views/superconductor/issues/edit.html.erb
  13. +39 −0 app/views/superconductor/issues/index.html.erb
  14. +5 −0 app/views/superconductor/issues/new.html.erb
  15. +50 −0 app/views/superconductor/issues/show.html.erb
  16. +2 −0  config/routes.rb
  17. +17 −0 db/migrate/20120123215136_create_superconductor_issues.rb
  18. +1 −1  lib/superconductor/version.rb
  19. +23 −0 test/fixtures/superconductor/issues.yml
  20. +49 −0 test/functional/superconductor/issues_controller_test.rb
  21. +4 −0 test/unit/helpers/superconductor/issues_helper_test.rb
  22. +7 −0 test/unit/superconductor/issue_test.rb
View
2  app/assets/javascripts/superconductor/issues.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
View
56 app/assets/stylesheets/scaffold.css
@@ -0,0 +1,56 @@
+body { background-color: #fff; color: #333; }
+
+body, 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; }
+a:visited { color: #666; }
+a:hover { color: #fff; background-color:#000; }
+
+div.field, div.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;
+}
+
+#error_explanation 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;
+}
+
+#error_explanation ul li {
+ font-size: 12px;
+ list-style: square;
+}
View
4 app/assets/stylesheets/superconductor/issues.css
@@ -0,0 +1,4 @@
+/*
+ Place all the styles related to the matching controller here.
+ They will automatically be included in application.css.
+*/
View
18 app/assets/stylesheets/superconductor/panel.css.scss
@@ -7,6 +7,7 @@ body.debugging {
}
section#superconductor_panel {
+ details summary { cursor: pointer; }
color: white;
z-index: 998;
a, a:link, a:visited { color: white; }
@@ -21,23 +22,20 @@ section#superconductor_panel {
bottom: 0px;
right: -300px;
width: 300px;
- footer { clear: both; height: 0px; }
+ br { clear: both; height: 0px; }
background: -webkit-gradient(linear, left top, left bottom, from(#444444), to(#222222));
- & > details {
- -webkit-transition: height 2s;
- summary {
- & > a { float: right; }
- cursor: pointer;
+ > details {
+ > summary {
+ background: -webkit-gradient(linear, left top, left bottom, from(#333333), to(#000000));
white-space: nowrap;
padding: 10px;
- }
- & > summary {
- background: -webkit-gradient(linear, left top, left bottom, from(#333333), to(#000000));
+ > a { float: right; }
}
dl {
padding: 5px 10px 10px 10px;
margin: 0px 5px 0px 5px;
dt {
+ font-weight: bold;
clear: left;
float: left;
min-width: 100px;
@@ -49,6 +47,8 @@ section#superconductor_panel {
overflow: hidden;
text-overflow: ellipsis;
}
+ > details {
+ }
}
}
}
View
83 app/controllers/superconductor/issues_controller.rb
@@ -0,0 +1,83 @@
+class Superconductor::IssuesController < ApplicationController
+ # GET /superconductor/issues
+ # GET /superconductor/issues.json
+ def index
+ @superconductor_issues = Superconductor::Issue.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @superconductor_issues }
+ end
+ end
+
+ # GET /superconductor/issues/1
+ # GET /superconductor/issues/1.json
+ def show
+ @superconductor_issue = Superconductor::Issue.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @superconductor_issue }
+ end
+ end
+
+ # GET /superconductor/issues/new
+ # GET /superconductor/issues/new.json
+ def new
+ @superconductor_issue = Superconductor::Issue.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @superconductor_issue }
+ end
+ end
+
+ # GET /superconductor/issues/1/edit
+ def edit
+ @superconductor_issue = Superconductor::Issue.find(params[:id])
+ end
+
+ # POST /superconductor/issues
+ # POST /superconductor/issues.json
+ def create
+ @superconductor_issue = Superconductor::Issue.new(params[:superconductor_issue])
+
+ respond_to do |format|
+ if @superconductor_issue.save
+ format.html { redirect_to @superconductor_issue, notice: 'Issue was successfully created.' }
+ format.json { render json: @superconductor_issue, status: :created, location: @superconductor_issue }
+ else
+ format.html { render action: "new" }
+ format.json { render json: @superconductor_issue.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PUT /superconductor/issues/1
+ # PUT /superconductor/issues/1.json
+ def update
+ @superconductor_issue = Superconductor::Issue.find(params[:id])
+
+ respond_to do |format|
+ if @superconductor_issue.update_attributes(params[:superconductor_issue])
+ format.html { redirect_to @superconductor_issue, notice: 'Issue was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: "edit" }
+ format.json { render json: @superconductor_issue.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /superconductor/issues/1
+ # DELETE /superconductor/issues/1.json
+ def destroy
+ @superconductor_issue = Superconductor::Issue.find(params[:id])
+ @superconductor_issue.destroy
+
+ respond_to do |format|
+ format.html { redirect_to superconductor_issues_url }
+ format.json { head :no_content }
+ end
+ end
+end
View
2  app/helpers/superconductor/issues_helper.rb
@@ -0,0 +1,2 @@
+module Superconductor::IssuesHelper
+end
View
4 app/helpers/superconductor/panel_helper.rb
@@ -1,5 +1,5 @@
module Superconductor::PanelHelper
- def superconductor_panel
- render "superconductor/panel"
+ def superconductor_panel(&block)
+ render :layout => "superconductor/panel", &block
end
end
View
5 app/models/superconductor.rb
@@ -0,0 +1,5 @@
+module Superconductor
+ def self.table_name_prefix
+ 'superconductor_'
+ end
+end
View
2  app/models/superconductor/issue.rb
@@ -0,0 +1,2 @@
+class Superconductor::Issue < ActiveRecord::Base
+end
View
30 app/views/superconductor/_panel.html.erb
@@ -22,7 +22,7 @@
<dt>Format</dt>
<dd><%= request.format %></dd>
</dl>
- <footer />
+ <br />
</details>
</details>
<details open>
@@ -30,10 +30,31 @@
<dl>
<% controller.instance_variables.reject { |k| k.to_s.starts_with?('@_') }.map { |k| [k, instance_variable_get(k)] }.each do |k, v| %>
<dt><%= k %></dt>
- <dd><%= v %></dd>
+ <dd>
+ <% if v.is_a?(ActiveRecord::Relation) %>
+ <details>
+ <summary><%= v.klass.name.pluralize %></summary>
+ <dl>
+ <dd><%= v.to_sql %>
+ </dl>
+ </details>
+ <% elsif v.is_a?(ActiveRecord::Base) %>
+ <details>
+ <summary><%= "New " if v.new_record? %><%= v.class.name %></summary>
+ <dl>
+ <% v.attributes.each do |attribute,value| %>
+ <dt><%= attribute %></dt>
+ <dd><%= value %></dd>
+ <% end %>
+ </dl>
+ </details>
+ <% else %>
+ <%= v %>
+ <% end %>
+ </dd>
<% end %>
- <footer />
</dl>
+ <br />
</details>
<details>
<summary>Session</summary>
@@ -50,7 +71,7 @@
<summary>
<%= controller.class.name %>#<%= action_name %>
<a href="edit-source://<%= file %>?<%= lineno %>">Edit Source</a>
- <footer />
+ <br />
</summary>
<%= form_tag superconductor_file_path, :method => :put do %>
<%= hidden_field_tag :file, file %>
@@ -59,4 +80,5 @@
</details>
<% rescue %>
<% end %>
+ <%= yield %>
</section>
View
53 app/views/superconductor/issues/_form.html.erb
@@ -0,0 +1,53 @@
+<%= form_for(@superconductor_issue) do |f| %>
+ <% if @superconductor_issue.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@superconductor_issue.errors.count, "error") %> prohibited this superconductor_issue from being saved:</h2>
+
+ <ul>
+ <% @superconductor_issue.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :use[B^Ctring %><br />
+ <%= f.text_field :use[B^Ctring %>
+ </div>
+ <div class="field">
+ <%= f.label :email %><br />
+ <%= f.text_field :email %>
+ </div>
+ <div class="field">
+ <%= f.label :votes %><br />
+ <%= f.number_field :votes %>
+ </div>
+ <div class="field">
+ <%= f.label :position %><br />
+ <%= f.text_field :position %>
+ </div>
+ <div class="field">
+ <%= f.label :title %><br />
+ <%= f.text_field :title %>
+ </div>
+ <div class="field">
+ <%= f.label :body %><br />
+ <%= f.text_field :body %>
+ </div>
+ <div class="field">
+ <%= f.label :state %><br />
+ <%= f.text_field :state %>
+ </div>
+ <div class="field">
+ <%= f.label :labels %><br />
+ <%= f.text_field :labels %>
+ </div>
+ <div class="field">
+ <%= f.label :closed_at %><br />
+ <%= f.datetime_select :closed_at %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
View
6 app/views/superconductor/issues/edit.html.erb
@@ -0,0 +1,6 @@
+<h1>Editing superconductor_issue</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @superconductor_issue %> |
+<%= link_to 'Back', superconductor_issues_path %>
View
39 app/views/superconductor/issues/index.html.erb
@@ -0,0 +1,39 @@
+<h1>Listing superconductor_issues</h1>
+
+<table>
+ <tr>
+ <th>Use[b^ctring</th>
+ <th>Email</th>
+ <th>Votes</th>
+ <th>Position</th>
+ <th>Title</th>
+ <th>Body</th>
+ <th>State</th>
+ <th>Labels</th>
+ <th>Closed at</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+
+<% @superconductor_issues.each do |superconductor_issue| %>
+ <tr>
+ <td><%= superconductor_issue.use[B^Ctring %></td>
+ <td><%= superconductor_issue.email %></td>
+ <td><%= superconductor_issue.votes %></td>
+ <td><%= superconductor_issue.position %></td>
+ <td><%= superconductor_issue.title %></td>
+ <td><%= superconductor_issue.body %></td>
+ <td><%= superconductor_issue.state %></td>
+ <td><%= superconductor_issue.labels %></td>
+ <td><%= superconductor_issue.closed_at %></td>
+ <td><%= link_to 'Show', superconductor_issue %></td>
+ <td><%= link_to 'Edit', edit_superconductor_issue_path(superconductor_issue) %></td>
+ <td><%= link_to 'Destroy', superconductor_issue, confirm: 'Are you sure?', method: :delete %></td>
+ </tr>
+<% end %>
+</table>
+
+<br />
+
+<%= link_to 'New Issue', new_superconductor_issue_path %>
View
5 app/views/superconductor/issues/new.html.erb
@@ -0,0 +1,5 @@
+<h1>New superconductor_issue</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', superconductor_issues_path %>
View
50 app/views/superconductor/issues/show.html.erb
@@ -0,0 +1,50 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <b>Use[b^ctring:</b>
+ <%= @superconductor_issue.use[B^Ctring %>
+</p>
+
+<p>
+ <b>Email:</b>
+ <%= @superconductor_issue.email %>
+</p>
+
+<p>
+ <b>Votes:</b>
+ <%= @superconductor_issue.votes %>
+</p>
+
+<p>
+ <b>Position:</b>
+ <%= @superconductor_issue.position %>
+</p>
+
+<p>
+ <b>Title:</b>
+ <%= @superconductor_issue.title %>
+</p>
+
+<p>
+ <b>Body:</b>
+ <%= @superconductor_issue.body %>
+</p>
+
+<p>
+ <b>State:</b>
+ <%= @superconductor_issue.state %>
+</p>
+
+<p>
+ <b>Labels:</b>
+ <%= @superconductor_issue.labels %>
+</p>
+
+<p>
+ <b>Closed at:</b>
+ <%= @superconductor_issue.closed_at %>
+</p>
+
+
+<%= link_to 'Edit', edit_superconductor_issue_path(@superconductor_issue) %> |
+<%= link_to 'Back', superconductor_issues_path %>
View
2  config/routes.rb
@@ -1,4 +1,6 @@
Rails.application.routes.draw do
+ namespace :superconductor do resources :issues end
+
namespace :superconductor do
put 'file' => 'file#update', :as => :file
end
View
17 db/migrate/20120123215136_create_superconductor_issues.rb
@@ -0,0 +1,17 @@
+class CreateSuperconductorIssues < ActiveRecord::Migration
+ def change
+ create_table :superconductor_issues do |t|
+ t.string :use[B^Ctring
+ t.string :email
+ t.integer :votes
+ t.float :position
+ t.string :title
+ t.string :body
+ t.string :state
+ t.array :labels
+ t.datetime :closed_at
+
+ t.timestamps
+ end
+ end
+end
View
2  lib/superconductor/version.rb
@@ -1,3 +1,3 @@
module Superconductor
- VERSION = "0.0.1"
+ VERSION = "0.0.2"
end
View
23 test/fixtures/superconductor/issues.yml
@@ -0,0 +1,23 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+one:
+ use[B^Ctring: MyString
+ email: MyString
+ votes: 1
+ position: 1.5
+ title: MyString
+ body: MyString
+ state: MyString
+ labels:
+ closed_at: 2012-01-23 14:51:36
+
+two:
+ use[B^Ctring: MyString
+ email: MyString
+ votes: 1
+ position: 1.5
+ title: MyString
+ body: MyString
+ state: MyString
+ labels:
+ closed_at: 2012-01-23 14:51:36
View
49 test/functional/superconductor/issues_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class Superconductor::IssuesControllerTest < ActionController::TestCase
+ setup do
+ @superconductor_issue = superconductor_issues(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:superconductor_issues)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create superconductor_issue" do
+ assert_difference('Superconductor::Issue.count') do
+ post :create, superconductor_issue: @superconductor_issue.attributes
+ end
+
+ assert_redirected_to superconductor_issue_path(assigns(:superconductor_issue))
+ end
+
+ test "should show superconductor_issue" do
+ get :show, id: @superconductor_issue
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @superconductor_issue
+ assert_response :success
+ end
+
+ test "should update superconductor_issue" do
+ put :update, id: @superconductor_issue, superconductor_issue: @superconductor_issue.attributes
+ assert_redirected_to superconductor_issue_path(assigns(:superconductor_issue))
+ end
+
+ test "should destroy superconductor_issue" do
+ assert_difference('Superconductor::Issue.count', -1) do
+ delete :destroy, id: @superconductor_issue
+ end
+
+ assert_redirected_to superconductor_issues_path
+ end
+end
View
4 test/unit/helpers/superconductor/issues_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class Superconductor::IssuesHelperTest < ActionView::TestCase
+end
View
7 test/unit/superconductor/issue_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class Superconductor::IssueTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.