123 lines
5.8 KiB
Text
123 lines
5.8 KiB
Text
<% title "Dashboard - DEV" %>
|
|
|
|
<div class="dashboard-container">
|
|
<div class="actions">
|
|
<a class="action <%= 'active' if params[:which] == "organization" || params[:which].blank? %>" href="/dashboard">
|
|
<span>POSTS</span>
|
|
<span>(<%= @user.articles_count %>)</span>
|
|
</a>
|
|
<a class="action <%= 'active' if params[:which] == "user_followers" %>" href="/dashboard/user_followers">
|
|
<span>FOLLOWERS</span>
|
|
<span>(<%= @user.followers_count %>)</span>
|
|
</a>
|
|
<a class="action <%= 'active' if params[:which] == "following_users" %>" href="/dashboard/following_users">
|
|
<span>FOLLOWING</span>
|
|
<span>(<%= @user.following_users_count %>)</span>
|
|
</a>
|
|
</div>
|
|
<% if @user.org_admin && @user.organization %>
|
|
<h1>
|
|
<a href="/dashboard" class=<%= "active" if params[:which].blank? %>>MY POSTS</a>
|
|
<a href="/dashboard/organization" class=<%= "active" if params[:which] == "organization" %>><%= @user.organization.name.upcase %> POSTS</a>
|
|
</h1>
|
|
<% end %>
|
|
<% if @user.org_admin && @user.organization && params[:which] == "organization" %>
|
|
<% if current_user.can_view_analytics? %>
|
|
<div class="dashboard-analytics-header-wrapper">
|
|
<div class="dashboard-analytics-header loaded">
|
|
<img src="<%= asset_path "emoji/emoji-one-heart.png" %>" /><span><%= number_with_delimiter(@articles.sum(&:positive_reactions_count), delimeter: ",") %> Total Post Reactions</span>
|
|
</div>
|
|
<div class="dashboard-analytics-header" id="dashboard-analytics-header">
|
|
<img id="dashboard-analytics-image" src="<%= asset_path "emoji/apple-eyes.png" %>" /><span id="dashboard-analytics">Loading Views Data...</span>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% @articles.each do |article| %>
|
|
<div class="single-article">
|
|
<a href="<%= article.current_state_path %>"><h2><%= article.title %></h2></a>
|
|
<div>
|
|
<% if !article.published %>
|
|
<span class="pill cta yellow">DRAFT</span>
|
|
<% end %>
|
|
<a href="<%= article.path %>/edit" class="pill cta green">EDIT</a>
|
|
<% if article.published && current_user.can_view_analytics? %>
|
|
<span id="pageviews-<%= article.id %>" class="cta pill dashboard-pageviews-indicator" data-analytics-pageviews data-article-id="<%= article.id %>">Loading View Data...</span>
|
|
<% end %>
|
|
</div>
|
|
<%= form_for(article) do |f| %>
|
|
<input type="hidden" name="destination" value="/dashboard" />
|
|
AUTHOR: <%= f.select(:user_id, options_for_select(@user.organization.users.map {|x| [x.name, x.id] }, article.user_id )) %>
|
|
<%= f.submit "SUBMIT AUTHOR CHANGE", class:"cta pill black" %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% elsif params[:which] == "user_followers" || params[:which] == "following_users" %>
|
|
<% @follows.each do |follow| %>
|
|
<% user = params[:which] == "user_followers" ? follow.follower : follow.followable %>
|
|
<div class="single-article">
|
|
<a href="<%= user.path %>" class="block-link">
|
|
<h2>
|
|
<img alt="<%= user.username %> profile image" src="<%= ProfileImage.new(user).get(60)%>" />
|
|
<%= user.name %>
|
|
<span class="dashboard-username">@<%= user.username %></a>
|
|
</h2>
|
|
</a>
|
|
</div>
|
|
<% end %>
|
|
<% elsif @articles.any? %>
|
|
<% if current_user.can_view_analytics? %>
|
|
<div class="dashboard-analytics-header-wrapper">
|
|
<div class="dashboard-analytics-header loaded">
|
|
<img src="<%= asset_path "emoji/emoji-one-heart.png" %>" /><span><%= number_with_delimiter(@articles.sum(&:positive_reactions_count), delimeter: ",") %> Total Post Reactions</span>
|
|
</div>
|
|
<div class="dashboard-analytics-header" id="dashboard-analytics-header">
|
|
<img id="dashboard-analytics-image" src="<%= asset_path "emoji/apple-eyes.png" %>" /><span id="dashboard-analytics">Loading Views Data...</span>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% if current_user.has_role?(:video_permission) %>
|
|
<a class="video-upload-cta" href="/videos/new" data-no-instant>
|
|
Upload a Video 🎥
|
|
</a>
|
|
<% end %>
|
|
<% @articles.each do |article| %>
|
|
<div class="single-article">
|
|
<a href="<%= article.current_state_path %>">
|
|
<h2>
|
|
<%= article.title %>
|
|
</h2>
|
|
</a>
|
|
<div class="dashboard-actions">
|
|
<% if article.published %>
|
|
<a href="<%= article.path %>" class="cta pill">PUBLISHED</a>
|
|
<% else %>
|
|
<a href="<%= article.path %>?preview=<%= article.password %>" class="cta pill yellow">DRAFT</a>
|
|
<% end %>
|
|
<a href="<%= article.path %>/edit" class="cta pill green">EDIT</a>
|
|
<a href="<%= article.path %>/delete_confirm" data-no-instant class="cta pill black">DELETE</a>
|
|
<% if article.published && current_user.can_view_analytics? %>
|
|
<span id="pageviews-<%= article.id %>" class="cta pill dashboard-pageviews-indicator" data-analytics-pageviews data-article-id="<%= article.id %>">Loading View Data...</span>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% else %>
|
|
<div class="no-articles">
|
|
<h3>This is where you can manage your posts, but you haven't written anything yet.</h3>
|
|
<a href="/new" class="cta big">
|
|
Write your first post now
|
|
</a>
|
|
<%=image_tag(cl_image_path(asset_path("/assets/sloan.png"),
|
|
:type=>"fetch",
|
|
:width => 300,
|
|
:crop => "imagga_scale",
|
|
:quality => "auto",
|
|
:flags => "progressive",
|
|
:fetch_format => "auto",
|
|
:sign_url => true), class:"sloan", alt:"sloth-mascot") %>
|
|
<br/>
|
|
<h3>Also check out the <a href="/welcome" data-no-instant>Welcome Thread</a> to introduce yourself!</h3>
|
|
</div>
|
|
<% end %>
|
|
</div>
|