Skip to content

Commit

Permalink
Update styling, mark edited journals
Browse files Browse the repository at this point in the history
For #128
  • Loading branch information
asilano committed Mar 12, 2016
1 parent a157599 commit 86d2794
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/_colours.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $play-treasure-colour: darken($treasure, 10%);
$reaction-blue: #337;
$buy-gold: $treasure * 0.75;

$p0col: #fcc;
$p0col: #fdb;
$p1col: #ffd;
$p2col: #cfc;
$p3col: #dff;
Expand Down
3 changes: 3 additions & 0 deletions app/assets/stylesheets/_mixins.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
$header-height: 230px;

.lighter {font-weight: normal; color: #ccc;}
.bold {font-weight: bold;}
.red { color: red; }
.error { background-color: lighten(red, 25%); }

@mixin when-smaller-than($breakpoint) {
@if $breakpoint == small {
Expand Down
2 changes: 0 additions & 2 deletions app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

@import "form-styles";

.red { color: red; }

.design {
border: 1px solid blue;
}
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/games.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}
}

.bold, .current {font-weight: bold;}
.current {font-weight: bold;}

&.ended.rowEven {background-color: #ffe0e0;}
&.ended.rowOdd {background-color: #fbb;}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/journals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def update
if params[:journal].andand[:event].andand.blank?
@journal.destroy
else
@journal.update(journal_params)
@journal.update(journal_params.merge({ modified: true }))
end
respond_to do |format|
format.html { redirect_to play_game_path(@journal.game), status: :see_other }
Expand Down
2 changes: 1 addition & 1 deletion app/models/player.rb
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ def draw_cards(num, reason = nil)
else
drawn_string << "#{cards_drawn.join(', ')}|#{cards_drawn.length} card#{cards_drawn.length == 1 ? '' : 's'}]"
end
raise

game.add_history(:event => "#{name} drew #{drawn_string}#{reason}.",
:css_class => "player#{seat} card_draw #{'shuffle' if (shuffle_point > 0 && shuffle_point < cards_drawn.length)}")
end
Expand Down
22 changes: 12 additions & 10 deletions app/views/games/_journals.html.slim
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
ul
- @game.journals.each do |journal|
li.journal class=('red' if journal.errors.any?)
li.journal class=('error' if journal.errors.any?)
- if journal.modified
span.bold>[] (Edited)
- if journal.player == @player && journal.order > @game.last_blocked_journal
span.insert data-order=journal.order
= best_in_place journal, :event, class: 'change_journal', other_fields: {game_id: @game.id}, html_attrs: {style: 'width: 100%', autocomplete: 'off'}
- else
span.immutable= journal.event
-if journal.errors.any?
ul.journal_errors
- journal.errors.full_messages.each do |msg|
li= msg
- journal.histories.each do |history|
- classes = history.css_class
- if @player && history.css_class =~ /\bplayer#{@player.seat}\b/
- classes += ' self'
li class=classes = format_history(history, @player)
-if journal.errors.any?
ul.journal_errors.error
- journal.errors.full_messages.each do |msg|
li= msg
- journal.histories.each do |history|
- classes = history.css_class
- if @player && history.css_class =~ /\bplayer#{@player.seat}\b/
- classes += ' self'
li class=classes = format_history(history, @player)
5 changes: 5 additions & 0 deletions db/migrate/20160312145617_add_modified_to_journals.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddModifiedToJournals < ActiveRecord::Migration
def change
add_column :journals, :modified, :boolean, default: false
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20160202160833) do
ActiveRecord::Schema.define(version: 20160312145617) do

create_table "chats", force: true do |t|
t.integer "game_id"
Expand All @@ -37,6 +37,7 @@
t.text "event"
t.datetime "created_at"
t.integer "order"
t.boolean "modified", default: false
end

add_index "journals", ["game_id"], name: "index_journals_on_game_id"
Expand Down

0 comments on commit 86d2794

Please sign in to comment.