diff --git a/.env.example b/.env.example index d65034c..d3b2c45 100644 --- a/.env.example +++ b/.env.example @@ -8,7 +8,6 @@ PUMA_WORKERS=1 PUMA_MIN_THREADS=1 PUMA_MAX_THREADS=16 PUMA_PORT=4000 -PUMA_SOCKET=/tmp/ensl.sock PUMA_TIMEOUT=30 MYSQL_DATABASE=ensl diff --git a/app/assets/stylesheets/_variables.scss b/app/assets/stylesheets/_variables.scss index b25a6be..8a1e0a9 100644 --- a/app/assets/stylesheets/_variables.scss +++ b/app/assets/stylesheets/_variables.scss @@ -88,7 +88,7 @@ $navbar-text: white; $flash-text: white; $flash-notice: #5a9aa8; -$flash-success: #1f7f5c; +$flash-success: $green; $flash-warning: $red; $flash-error: #e56c69; @@ -107,5 +107,5 @@ $input-dark-border-hover-colour: $blue; $input-dark-border-focus-colour: $green; $button-primary: #5a9aa8; -$button-secondary: #1f7f5c; +$button-secondary: $green; $button-text: white; diff --git a/app/assets/stylesheets/components/_flashes.scss b/app/assets/stylesheets/components/_flashes.scss index bb5d9d1..d290069 100644 --- a/app/assets/stylesheets/components/_flashes.scss +++ b/app/assets/stylesheets/components/_flashes.scss @@ -12,6 +12,7 @@ &.success { @include flash($flash-success); + &:before { content: "\f00c"; } @@ -19,6 +20,7 @@ &.error { @include flash($flash-error); + &:before { content: "\f00d"; } @@ -27,6 +29,7 @@ &.warning, &.alert { @include flash($flash-warning); + &:before { content: "\f071"; } @@ -42,10 +45,6 @@ div#errors { @include span-columns(12); margin-bottom: em(20); - &:before { - height: 100%; - } - strong { @include span-columns(12); margin-bottom: em(10); diff --git a/app/assets/stylesheets/components/_forms.scss b/app/assets/stylesheets/components/_forms.scss index 31acc1e..410696e 100644 --- a/app/assets/stylesheets/components/_forms.scss +++ b/app/assets/stylesheets/components/_forms.scss @@ -3,6 +3,17 @@ */ form { + .inline { + float: left; + display: inline-block; + width: auto; + margin-bottom: em(20); + + input { + margin-bottom: 0; + } + } + .fields { > .field_with_errors:first-child, > label { @@ -122,10 +133,13 @@ form { } &:hover { + border: $input-border-width solid lighten($input-secondary, 20%); cursor: pointer; } &:checked { + border-color: $button-secondary; + &:after { content: $fa-var-check; pointer-events: none; @@ -136,6 +150,7 @@ form { font-size: em(22); top: em(4); left: em(5); + color: $button-secondary; } } } diff --git a/app/assets/stylesheets/mixins/_flashes.scss b/app/assets/stylesheets/mixins/_flashes.scss index 2a20957..201ce22 100644 --- a/app/assets/stylesheets/mixins/_flashes.scss +++ b/app/assets/stylesheets/mixins/_flashes.scss @@ -23,7 +23,7 @@ left: 0; float: left; width: em(44); - height: em(44); + height: 100%; padding: em(9); line-height: em(26); text-align: center; diff --git a/app/assets/stylesheets/pages/_news.scss b/app/assets/stylesheets/pages/_news.scss index 24a15cd..f636657 100644 --- a/app/assets/stylesheets/pages/_news.scss +++ b/app/assets/stylesheets/pages/_news.scss @@ -10,6 +10,14 @@ div.article { .content { @include span-columns(12); margin-bottom: em(40); + + ul { + list-style-type: disc; + + li { + margin-left: em(20); + } + } } .author { diff --git a/app/assets/stylesheets/pages/_users.scss b/app/assets/stylesheets/pages/_users.scss index 1f0f184..fbd53b6 100644 --- a/app/assets/stylesheets/pages/_users.scss +++ b/app/assets/stylesheets/pages/_users.scss @@ -53,3 +53,80 @@ } } } + +/* + Agenda +*/ + +#agenda { + + h4 { + margin-bottom: 1em; + } + + table { + margin-bottom: em(20); + } + + form { + @include span-columns(12); + margin-bottom: em(20); + } + + .tab { + :last-child { + margin-bottom: 0; + } + } + + #teams { + + table { + margin-bottom: em(40); + } + } +} + +/* + Messages +*/ + +#messages { + h1 { + margin-bottom: 1em; + } + + .tab { + + :last-child { + margin-bottom: 0; + } + } + + .message { + @include span-columns(12); + margin-bottom: em(20); + + .subject { + margin-bottom: 1em; + } + + .content { + margin-bottom: em(20); + } + + a.message { + display: inline; + margin: 0; + float: none; + } + + &.highlight { + font-weight: bold; + } + } + + .back { + margin-top: em(20); + } +} diff --git a/app/views/messages/_message.html.erb b/app/views/messages/_message.html.erb new file mode 100644 index 0000000..8422028 --- /dev/null +++ b/app/views/messages/_message.html.erb @@ -0,0 +1,9 @@ +
<%= namelink message %>
+ +

+ <%= sanitize message.text[0, 100] %>... +

+ +

+ <%= namelink message.sender %> on <%= longdate message.created_at %> +

diff --git a/app/views/messages/index.html.erb b/app/views/messages/index.html.erb index 70fe85c..1d9ed26 100644 --- a/app/views/messages/index.html.erb +++ b/app/views/messages/index.html.erb @@ -1,39 +1,47 @@ -

Received Messages (<%= cuser.new_messages.count %> unread / <%= cuser.received_messages.count %> total)

+
+

Private Messages

-<% cuser.received_messages.reverse_each do |message| %> -
-
- <% if cuser.new_messages.include?(message) %> -

+

+ +
+
+ <% if cuser.received_messages.any? %> + <% cuser.received_messages.reverse_each do |message| %> +
+ <%= render partial: 'message', locals: { message: message } %> +
<% end %> - <%= namelink message %> - - <%= sanitize message.text[0, 20] %> - - <% if cuser.new_messages.include?(message) %> -

+ <% else %> +

You have no incoming messages.

<% end %>
-
- (<%= namelink message.sender %> on <%= longdate message.created_at %>) +
+ <% if cuser.sent_messages.any? %> + <% cuser.sent_messages.reverse_each do |message| %> +
+ <%= render partial: 'message', locals: { message: message } %> +
+ <% end %> + <% else %> +

You have no sent messages.

+ <% end %>
-
-<% end %> +
-

Sent Messages (<%= cuser.sent_messages.count %> total)

- -<% cuser.sent_messages.reverse_each do |message| %> -
-
- <%= namelink message %> - - <%= sanitize message.text[0, 20] %> - -
-
- (<%= namelink message.recipient %> on <%= longdate message.created_at %>) -
-
-
-<% end %> + diff --git a/app/views/messages/new.html.erb b/app/views/messages/new.html.erb index be3f4fe..05bc7e5 100644 --- a/app/views/messages/new.html.erb +++ b/app/views/messages/new.html.erb @@ -1,29 +1,29 @@ -
-

New message

+
+

New Message

- <%= form_for(@message) do |f| %> + <%= form_for(@message, html: { class: 'square' }) do |f| %> <%= f.error_messages %> <%= f.hidden_field :recipient_id %> <%= f.hidden_field :recipient_type %> -

- <%= f.label :sender %>
+

+ <%= f.label :sender %> <%= f.select :sender_raw, cuser.to_s, {:include_blank => cuser.to_s} %> -

- <%= f.label :recipient %>
- <%= text_field_tag :asdf, @message.recipient, :disabled => true %> -

-

- <%= f.label :title %>
- <%= f.text_field :title %> -

-

- <%= f.label :text %>
- <%= f.text_area :text %> -

-

- <%= f.submit 'Send' %> -

-<% end %> -<%= link_to 'Back', messages_path %> +
+
+ <%= f.label :recipient %> + <%= text_field_tag :asdf, @message.recipient, :disabled => true %> +
+
+ <%= f.label :title %> + <%= f.text_field :title %> +
+
+ <%= f.label :text %> + <%= f.text_area :text %> +
+
+ <%= f.submit 'Send Message' %> +
+ <% end %>
diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb index 194286b..5a4d399 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -1,22 +1,24 @@ -

<%= link_to 'Back to the Inbox', messages_path %>


+
+

Private Message

-<% @messages.each do |message| %> -
-

"> - <%= raw("»") if message == @message %> - <%= namelink message %> -

-
- <%= raw message.text_parsed %> + <% @messages.each do |message| %> +
+

"> + <%= icon("chevron-right") if message == @message %> + <%= namelink message %> +

+
+ <%= raw message.text_parsed %> +
+

Sent by: <%= namelink message.sender %> on <%= shortdate message.created_at %>

+

+ <%= link_to "Reply", + { controller: "messages", action: "new", id: message.sender_type, id2: message.sender_id, title: message.title }, + { class: 'button tiny'} %> +

-

- Sent by: <%= namelink message.sender %> - on <%= shortdate message.created_at %> -

-

- <%= link_to "Reply", :controller => "messages", :action => "new", :id => message.sender_type, :id2 => message.sender_id, :title => message.title %> -

-
-<% end %> + <% end %> -

<%= link_to 'Back to the Inbox', messages_path %>

+ <%= link_to 'Back to Messages', messages_path, class: 'button back' %> +
+ \ No newline at end of file diff --git a/app/views/users/agenda.html.erb b/app/views/users/agenda.html.erb index 8a7e50b..cf9ea92 100644 --- a/app/views/users/agenda.html.erb +++ b/app/views/users/agenda.html.erb @@ -1,5 +1,5 @@ -
-
    +
    + -
    +
    - +

    Your Teams

    + +
    @@ -21,7 +23,7 @@ <% @user.teamers.active.each do |teamer| %> - @@ -29,12 +31,11 @@ <% end %> @@ -44,33 +45,32 @@ <%= form_for @teamer do |f| %> <%= f.error_messages %> <%= f.hidden_field :user_id %> -

    -

    - Join an existing team: -

    - <%= f.select :team_id, Team.active.collect {|t| [t.name, t.id]} %> - <%= f.submit "Join" %> -

    +

    Join an existing team

    + +
    + <%= f.select :team_id, Team.active.collect {|t| [t.name, t.id]} %> +
    +
    + <%= f.submit "Join", class: 'button' %> +
    <% end %> <% else %> -

    - You can join only one team at time. - Currently you are trying to join <%= namelink @user.teamers.joining.first.team %>. - You can cancel this request by clicking <%= link_to "here", @user.teamers.joining.first, :method => :delete %>. -

    +
    +

    You can join only be a member of one team at a time.

    +

    Currently you are trying to join <%= namelink @user.teamers.joining.first.team %>

    +

    You can cancel this request by clicking "Cancel Request"

    +
    + + <%= link_to "Cancel Request", @user.teamers.joining.first, method: :delete, class: 'button' %> <% end %> -

    - <%= link_to 'Create a new team', new_team_path %> -

    + <%= link_to 'Create a new team', new_team_path, class: 'button' %>
    <% if @user.challenges_received.future.pending.count > 0 %> -

    - Pending challenges for your response -

    +

    Pending challenges for your response

    Name Comment
    class="bold"<% end %>> + <%= link_to (h teamer.team.name), teamer.team %> <%= h teamer.comment %> <% if @user.team != teamer.team %> <%= form_for @user do |u| %> - <%= link_to("Set as Primary", user_path(@user, :user => { :team_id => teamer.team.id }), :method => :put, :confirm => "Are you sure?") %> - <%= link_to 'Leave', teamer, :confirm => 'Are you sure?', :method => :delete %> + <%= link_to("Set as Primary", user_path(@user, user: { team_id: teamer.team.id }), method: :put, confirm: "Are you sure?") %> <% end %> - <% else %> - <%= link_to 'Leave', teamer, :confirm => 'Are you sure?', :method => :delete %> <% end %> + + <%= link_to 'Leave', teamer, confirm: 'Are you sure?', method: :delete, class: 'button tiny' %>
    @@ -84,7 +84,7 @@ @@ -94,13 +94,10 @@ <% end %>
    <%= link_to ("Open"), challenge %> - | <%= link_to "Send a PM", :controller => "messages", :action => "new", :id => "Team", :id2 => challenge.contester1.team %> + <%= link_to "Send a PM", controller: "messages", action: "new", id: "Team", id2: challenge.contester1.team %> <%= namelink challenge.contester1 %> <%= longtime challenge.match_time %>
    -
    <% end %> <% if @user.challenges_sent.future.count > 0 %> -

    - Sent challenges -

    +

    Sent challenges

    @@ -130,9 +127,7 @@ <% end %> <% if @user.ref? and Match.future.unreffed.ordered.count > 0 %> -

    - Matches without referee -

    +

    Matches without referee

    @@ -147,96 +142,108 @@ - - <% end %> -
    <%= shorttime match.match_time %> <%= link_to 'Referee this match', - :remote => true, - :url => {:controller => "matches", :action => "update", :id => match.id, - :match => {:referee_id => @user.id}}, :method => "put", - :loading => "$('matchlink_#{match.id}').parentNode.innerHTML='Processing..';", - :success => "$('matchlink_#{match.id}').parentNode.innerHTML='Complete';", - :html => {:id => "matchlink_#{match.id}"} %> -
    + remote: true, + url: { + controller: "matches", action: "update", id: match.id, + match: { + referee_id: @user.id + } + }, + method: "put", + loading: "$('matchlink_#{match.id}').parentNode.innerHTML='Processing..';", + success: "$('matchlink_#{match.id}').parentNode.innerHTML='Complete';", + html: { id: "matchlink_#{match.id}" } %> + + <% end %> + + <% end %> - <% if @user.upcoming_matches.length > 0 # TODO: fix this %> -

    - Upcoming matches for your concern -

    + <% if @user.upcoming_matches.length > 0 # TODO: fix this %> +

    Upcoming matches for your concern

    - - - - - +
    TeamsDate
    + + + + - <% @user.upcoming_matches.each do |match| %> - - - - - <% end %> -
    TeamsDate
    <%= namelink match %><%= shorttime match.match_time %> -
    -
    + <% @user.upcoming_matches.each do |match| %> + + <%= namelink match %> + <%= shorttime match.match_time %> + + <% end %> + + <% end %> - <% if @user.past_matches.length > 0 %> -

    - Past matches waiting for scoring or lineup -

    + <% if @user.past_matches.length > 0 %> +

    Past matches waiting for scoring or lineup

    - - - - - +
    TeamsDate
    + + + + - <% @user.past_matches.each do |match| %> - - - - - <% end %> -
    TeamsDate
    <%= namelink match %><%= shorttime match.match_time %> -
    -
    + <% @user.past_matches.each do |match| %> + + <%= namelink match %> + <%= shorttime match.match_time %> + + <% end %> -
    - -
    - <%= render :partial => "articles/list", :locals => {:articles => @user.articles} %> - <%= link_to 'New article', new_article_path %> -
    - -
    - <%= render :partial => "movies/movie", :collection => @user.movies %> -
    - -
    - <%= render :partial => "servers/server", :collection => @user.servers %> - <%= link_to 'New server', new_server_path %> -
    - -
    -

    - Issues created by you -

    - <%= render :partial => "issues/list", :locals => {:issues => @user.issues} %> - -

    - Open issues assigned to you -

    - <%= render :partial => "issues/list", :locals => {:issues => @user.open_issues} %> - <%= link_to 'New issue', new_issue_path %> -
    - -
    - <%= render :partial => "bans/list", :locals => {:bans => @user.bans.effective} %> -
    -
    + + <% end %>
    - +
    + <% if @user.articles.size > 0 %> + <%= render partial: "articles/list", locals: { articles: @user.articles } %> + <% end %> + + <%= link_to 'New article', new_article_path, class: 'button' %> +
    + +
    + <%= render partial: "movies/movie", collection: @user.movies %> + + <%= link_to "New Movie", { controller: "data_files", action: "new", id: Directory::MOVIES }, { class: 'button' } %> +
    + +
    + <%= render partial: "servers/server", collection: @user.servers %> + + <%= link_to 'New server', new_server_path, class: 'button' %> +
    + +
    + <% if @user.issues.size > 0 %> +

    Issues created by you

    + <%= render partial: "issues/list", locals: { issues: @user.issues } %> + <% end %> + + <% if @user.open_issues.size > 0 %> +

    Open issues assigned to you

    + <%= render partial: "issues/list", locals: { issues: @user.open_issues } %> + <% end %> + + <%= link_to 'New issue', new_issue_path, class: 'button' %> +
    + +
    + <% if @user.bans.effective.size > 0 %> + <%= render partial: "bans/list", locals: { bans: @user.bans.effective } %> + <% else %> +

    You have no effective bans currently.

    + <% end %> +
    +
    +
+ + diff --git a/config/deploy.rb b/config/deploy.rb index a16c425..5cf56bf 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -12,7 +12,7 @@ set :rbenv_type, :user set :rbenv_ruby, '2.1.1' set :dotenv_role, [:app, :web] -set :puma_config, -> { File.join(shared_path, 'puma.rb') } +set :puma_config, -> { File.join(current_path, 'config', 'puma.rb') } set :puma_pid, -> { File.join(shared_path, 'tmp', 'pids', 'puma.pid') } set :writable_dirs, %w{public tmp} diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index 6f04ccb..58c65d4 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -1,4 +1,4 @@ -set :branch, 'feature-redesign' +set :branch, 'develop' set :deploy_to, '/var/www/virtual/ensl.org/staging/rails' set :rails_env, 'staging' diff --git a/config/locales/en.yml b/config/locales/en.yml index 19d054c..bf0bb69 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -46,7 +46,7 @@ en: hltv_stopped: "HLTV's stopped. Demos saved." hltv_moved: "HLTV moved." hltv_movedd: "HLTVs moved to: " - messages_create: "Message was successfully created." + message_create: "Message was successfully sent." movies_create: "Movie was successfully created." movies_update: "Movie was successfully updated." execute: "Executed: " diff --git a/config/puma.rb b/config/puma.rb index e22acfa..d5b690d 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -2,8 +2,8 @@ require "dotenv" Dotenv.load base_path = (ENV['DEPLOY_PATH'] || Dir.pwd) -current_path = "#{base_path}" -shared_path = "#{base_path}" +current_path = "#{base_path}/current" +shared_path = "#{base_path}/shared" stderr_path = "#{shared_path}/log/puma.stderr.log" stdout_path = "#{shared_path}/log/puma.stdout.log" @@ -11,7 +11,7 @@ tag 'ENSL' preload_app! daemonize true -directory base_path +directory current_path pidfile "#{shared_path}/tmp/pids/puma.pid" state_path "#{shared_path}/tmp/pids/puma.state" stdout_redirect stdout_path, stderr_path @@ -19,7 +19,7 @@ stdout_redirect stdout_path, stderr_path environment ENV['RACK_ENV'] || 'production' rackup DefaultRackup -bind "unix://#{shared_path}#{ENV['PUMA_SOCKET']}" +bind "unix://#{shared_path}/tmp/sockets/puma.sock" port Integer(ENV['PUMA_PORT'] || 4000) worker_timeout Integer(ENV['PUMA_TIMEOUT'] || 30)