forked from OpenNeo/impress
news posts read from the database, with a campaign-supplement classname option :)
This commit is contained in:
parent
49cd93087a
commit
b5442d0f3f
10 changed files with 53 additions and 5 deletions
|
@ -119,11 +119,14 @@ ul.buttons
|
|||
#locale-form
|
||||
float: right
|
||||
|
||||
.success, .alert, .warning
|
||||
=flash
|
||||
margin-bottom: 1em
|
||||
padding: .25em .5em
|
||||
text-align: center
|
||||
|
||||
.success, .alert, .warning
|
||||
+flash
|
||||
|
||||
.success
|
||||
+notice
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@ $outfit-banner-inner-width: $outfit-inner-width - (2 * $outfit-banner-h-padding)
|
|||
|
||||
body.campaigns-show, body.campaigns-current
|
||||
+campaign-progress
|
||||
color: #004
|
||||
color: $campaign-text-color
|
||||
|
||||
a
|
||||
color: #004 + #222
|
||||
color: $campaign-text-color + #222
|
||||
|
||||
#userbar, #footer
|
||||
color: $text-color
|
||||
|
@ -73,7 +73,7 @@ body.campaigns-show, body.campaigns-current
|
|||
|
||||
input[type=text]
|
||||
border-color: #cce
|
||||
color: #004
|
||||
color: $campaign-text-color
|
||||
width: 3em
|
||||
|
||||
button
|
||||
|
|
|
@ -3,6 +3,19 @@
|
|||
body.outfits-new
|
||||
+campaign-progress
|
||||
|
||||
.news-post
|
||||
p:last-child
|
||||
margin-bottom: 0
|
||||
|
||||
&.campaign-supplement
|
||||
+flash
|
||||
background: $campaign-background-color
|
||||
border: 1px solid $campaign-border-color
|
||||
color: $campaign-text-color
|
||||
|
||||
a
|
||||
color: $campaign-link-color
|
||||
|
||||
#pet-not-found, #neopia-error
|
||||
display: none
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
$campaign-border-color: #006
|
||||
$campaign-background-color: #eef
|
||||
$campaign-text-color: #004
|
||||
$campaign-link-color: $campaign-text-color + #222
|
||||
|
||||
=campaign-progress
|
||||
.campaign-progress-wrapper
|
||||
|
|
|
@ -79,6 +79,8 @@ class OutfitsController < ApplicationController
|
|||
@neopets_usernames = user_signed_in? ? current_user.neopets_usernames : []
|
||||
|
||||
@campaign = Campaign.current rescue nil
|
||||
|
||||
@news_posts = NewsPost.all
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
3
app/models/news_post.rb
Normal file
3
app/models/news_post.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class NewsPost < ActiveRecord::Base
|
||||
attr_accessible :body, :html_class
|
||||
end
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
= advertise_campaign_progress @campaign
|
||||
|
||||
- @news_posts.each do |news_post|
|
||||
.news-post{class: news_post.html_class}= md news_post.body
|
||||
|
||||
%p#pet-not-found.alert= t 'pets.load.not_found'
|
||||
%p#neopia-error.alert= t 'pets.load.neopia_error'
|
||||
|
||||
|
|
10
db/migrate/20150927033046_create_news_posts.rb
Normal file
10
db/migrate/20150927033046_create_news_posts.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class CreateNewsPosts < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :news_posts do |t|
|
||||
t.text :body
|
||||
t.string :html_class, default: 'success'
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20150923052017) do
|
||||
ActiveRecord::Schema.define(:version => 20150927033046) do
|
||||
|
||||
create_table "auth_servers", :force => true do |t|
|
||||
t.string "short_name", :limit => 10, :null => false
|
||||
|
@ -200,6 +200,13 @@ ActiveRecord::Schema.define(:version => 20150923052017) do
|
|||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "news_posts", :force => true do |t|
|
||||
t.text "body"
|
||||
t.string "html_class", :default => "success"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "outfit_features", :force => true do |t|
|
||||
t.integer "donation_id"
|
||||
t.integer "outfit_id"
|
||||
|
|
5
spec/models/news_post_spec.rb
Normal file
5
spec/models/news_post_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe NewsPost do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in a new issue