diff --git a/app/assets/stylesheets/dashboard.scss b/app/assets/stylesheets/dashboard.scss index 362c41ddc..ed283dfc0 100644 --- a/app/assets/stylesheets/dashboard.scss +++ b/app/assets/stylesheets/dashboard.scss @@ -8,12 +8,12 @@ margin: auto; h1 { - font-size: calc(16px + 0.3vw); + font-size: calc(15px + 0.2vw); font-family: $helvetica-condensed; font-stretch: condensed; - padding-bottom: 20px; + padding-bottom: 0px; text-align: center; - + margin-bottom: 0px; @media screen and (min-width: 600px) { text-align: left; } @@ -27,7 +27,7 @@ } .rounded-btn { - font-size: calc(16px + 0.3vw); + font-size: calc(15px + 0.2vw); font-family: $helvetica-condensed; font-stretch: condensed; padding: 4px 20px; @@ -36,21 +36,51 @@ display: inline-block; width: fit-content; margin-bottom: 10px; - color: $black; - background: lighten($light-medium-gray, 5%); - + @include themeable( + color, + theme-color, + $black + ); + @include themeable( + background, + theme-container-background, + lighten($light-medium-gray, 5%) + ); &:hover { - background: $light-medium-gray; + @include themeable( + background, + theme-container-background-hover, + $light-medium-gray + ); } &.active { - background: $dark-gray; - color: white; + @include themeable( + background, + theme-secondary-color, + $dark-gray + ); + @include themeable( + color, + theme-container-background, + white + ); } &.back-nav { left: 2vw; } + &.rounded-btn--transparent { + background: transparent; + font-size: calc(15px + 0.2vw); + &:hover { + @include themeable( + background, + theme-container-accent-background, + lighten($light-medium-gray, 10%) + ); + } + } } .actions { @@ -77,7 +107,7 @@ transition: background-color 250ms ease, opacity 250ms ease; font-family: $helvetica-condensed; font-stretch: condensed; - font-size: 1.1em; + font-size: 0.95em; text-align: center; &.active { diff --git a/app/controllers/credits_controller.rb b/app/controllers/credits_controller.rb index c148e5815..717c5b337 100644 --- a/app/controllers/credits_controller.rb +++ b/app/controllers/credits_controller.rb @@ -26,12 +26,18 @@ class CreditsController < ApplicationController credit_objects = Array.new(@number_to_purchase) do if params[:organization_id].present? + @purchaser = Organization.find(params[:organization_id]) Credit.new(organization_id: params[:organization_id], cost: cost_per_credit / 100.0) else + @purchaser = current_user Credit.new(user_id: current_user.id, cost: cost_per_credit / 100.0) end end Credit.import credit_objects + @purchaser.credits_count = @purchaser.credits.size + @purchaser.spent_credits_count = @purchaser.credits.where(spent: true).size + @purchaser.unspent_credits_count = @purchaser.credits.where(spent: false).size + @purchaser.save redirect_to "/credits", notice: "#{@number_to_purchase} new credits purchased!" end diff --git a/app/javascript/article-form/articleForm.jsx b/app/javascript/article-form/articleForm.jsx index dce23ea55..f1b7917da 100644 --- a/app/javascript/article-form/articleForm.jsx +++ b/app/javascript/article-form/articleForm.jsx @@ -303,7 +303,7 @@ export default class ArticleForm extends Component { ) : ( '' ); - const orgArea = organizations ? ( + const orgArea = (organizations && organizations.length > 0) ? ( 0) ? (
- <% if organizations %> + <% if organizations && organizations.size > 0 %>
- Publish under an organization: - <%= options_for_select({ "None" => "" }.merge(organizations.pluck(:name, :id).to_h), article.organization_id || "") %>
diff --git a/app/views/classified_listings/_form.html.erb b/app/views/classified_listings/_form.html.erb index 708d8d9a6..ac5b2d8ef 100644 --- a/app/views/classified_listings/_form.html.erb +++ b/app/views/classified_listings/_form.html.erb @@ -45,13 +45,13 @@ <%= form.label "tags_list", "Tags" %> <%= form.text_field "tags_list", placeholder: "8 tags max, comma separated, no spaces or special characters" %> - <% if @organizations.present? %> -
- <%= form.label "organization_id", "Post under an organization:" %> - <%= form.select :organization_id, "None" => "None" %> -

Posting on behalf of an organization spends the organization's credits.

-
- <% end %> + <% if @organizations.present? && @organizations.size > 0 %> +
+ <%= form.label "organization_id", "Post under an organization:" %> + <%= form.select :organization_id, "None" => "None" %> +

Posting on behalf of an organization spends the organization's credits.

+
+ <% end %> <%= javascript_pack_tag "listingForm", defer: true %> diff --git a/app/views/credits/index.html.erb b/app/views/credits/index.html.erb index 5b3a2185b..188e9c763 100644 --- a/app/views/credits/index.html.erb +++ b/app/views/credits/index.html.erb @@ -1,3 +1,5 @@ +<% title "Credits" %> +
<% if flash[:notice].present? %>
@@ -9,18 +11,14 @@ Purchase additional credits
<% if @organizations.present? %> -
-
- - has <%= @organizations.first.unspent_credits_count %> credits to spend -
- Purchase additional credits - <%= javascript_pack_tag "orgCreditsSelector", defer: true %> -
+ <% @organizations.each do |org| %> +
+
+ <%= org.name %> has <%= org.unspent_credits_count %> credits to spend +
+ Purchase additional credits +
+ <% end %> <% end %> <% if @credits.size > 0 %>
diff --git a/app/views/dashboards/_actions.html.erb b/app/views/dashboards/_actions.html.erb index 34bd93a59..4714ffacf 100644 --- a/app/views/dashboards/_actions.html.erb +++ b/app/views/dashboards/_actions.html.erb @@ -11,4 +11,9 @@ FOLLOWING (<%= @user.following_users_count + @user.following_tags_count + @user.following_organizations_count + @user.following_podcasts_count %>) + <% if @user.has_role? :pro %> + + PRO ANALYTICS + + <% end %>
diff --git a/app/views/dashboards/pro.html.erb b/app/views/dashboards/pro.html.erb index 507c3b89c..52bb3622e 100644 --- a/app/views/dashboards/pro.html.erb +++ b/app/views/dashboards/pro.html.erb @@ -1,5 +1,7 @@ +<% title "Pro Analytics" %> +
- Back to Main Dashboard + 👈 Back to Main Dashboard " href="/dashboard/pro"> Your Pro Dashboard diff --git a/app/views/dashboards/show.html.erb b/app/views/dashboards/show.html.erb index 11f34e6dc..1f88598e8 100644 --- a/app/views/dashboards/show.html.erb +++ b/app/views/dashboards/show.html.erb @@ -1,20 +1,13 @@ -<% title "Dashboard - DEV" %> +<% title "Dashboard" %>
<%= render "actions" %> - <% if @organizations && (params[:which].blank? || params[:which] == "organization") %> + <% if @organizations && @organizations.size > 0 && (params[:which].blank? || params[:which] == "organization") %>

">Personal <% @organizations.each do |org| %> "><%= org.name %> (<%= org.articles_count %>) <% end %> - <% if @user.has_role? :pro %> -
- Pro Analytics - <% @member_organizations.each do |org| %> - <%= org.name %> - <% end %> - <% end %>

<% end %> <% if params[:which] == "organization" %>