Commit 762ff07f authored by Marcelo Freitas's avatar Marcelo Freitas

Finishing projec deactivation feature

parent 7397740a
Pipeline #23944142 passed with stage
in 6 minutes and 9 seconds
exit
Comment.new.user_id=1
Comment.new
......@@ -16,6 +16,8 @@ gem 'file_validators'
gem 'therubyracer', platforms: :ruby
#Encrypting passwords:
gem 'bcrypt', '~> 3.1.7'
#for updating production models after migration
gem 'migration_data', '~> 0.2.1'
#github api
gem 'github_api', '~> 0.14.5'
......
......@@ -167,6 +167,7 @@ GEM
mail (2.7.0)
mini_mime (>= 0.1.1)
method_source (0.9.0)
migration_data (0.2.1)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
......@@ -350,6 +351,7 @@ DEPENDENCIES
inherited_resources!
jquery-rails
jquery-ui-rails (= 5.0.5)
migration_data (~> 0.2.1)
mina
mina-nginx
mina-puma!
......
......@@ -22,7 +22,7 @@ class ProjectsController < ApplicationController
end
def recent
@projects = Project.search(params[:search])
@projects = Project.active.search(params[:search])
@project = Project.new
@order_by = "Recents"
......@@ -30,7 +30,7 @@ class ProjectsController < ApplicationController
end
def most_favorited
@projects = Project.all.search(params[:search])
@projects = Project.active.search(params[:search])
@project = Project.new
@order_by ||= "Most favorited"
......
......@@ -3,7 +3,7 @@ class Project < ApplicationRecord
include Taggable
validates_presence_of :name
validates_uniqueness_of :name
validates_uniqueness_of :name, :case_sensitive => false
validates_presence_of :description, unless: :open_hub_id
validates :avatar, file_size: { less_than: 3.megabytes }
......
<footer class="site-footer">
<footer class="site-footer footer">
<div class="site-footer-legal">© <%= Time.current.year %> <%= site_name %></div>
<div class="site-footer-right">
<b>This work is a joint effort of: </b>
......
<ul class="blocks-3">
<% Project.limit(6).each do |project|%>
<% Project.active.limit(6).each do |project|%>
<li class="text-center">
<%= link_to project, class: "thumbnail m-0 avatar avatar-lg" do %>
<%=image_tag project.avatar.url %>
......
<ul class="blocks-2">
<li class="mega-menu m-0">
<ul class="list-icons">
<% tags = Tag.first(12)
tags = tags.in_groups_of(6,false)%>
<% tags = Tag.first(8)
tags = tags.in_groups_of(4,false)%>
<% tags[0].each do |tag, count| %>
<li><i class="md-chevron-right" aria-hidden="true"></i>
......
......@@ -37,7 +37,7 @@
</p>
<div class="col-md-12 mt-50">
<ul class="blocks-6">
<% Project.all.each do |project|%>
<% Project.active.each do |project|%>
<li class="text-left">
<%= link_to project, class:"thumbnail m-0" do %>
<%= image_tag project.image.url(:thumb), class:"center-block", width:50%>
......
<%= render 'visitor/header' unless current_user %>
<%= render 'visitor/menu' unless current_user %>
<div id="<%= @project.id %>" class="page-header page-header-bordered page-header-tabs nav-tabs-horizontal" data-plugin="tabs">
<%= render 'notices' %>
<figure class='logo-projeto text-center'>
<img class=" img-responsive" src="<%= @project.image_url %>"
style="max-width:250px;"/>
</figure>
<h1 class="page-title text-center"><%= @project.name %>
<% if @project.recent? %>
<span class="badge badge-danger badge-sm">New</span>
<% end %>
</h1>
<p class="tags text-center">
<% @project.tags.each do |tag| %>
<%= link_to projects_path(search: tag.to_s) do %>
<span class="badge badge-outline badge-primary"><%=tag.to_s%></span>
<% end %>
<% end %>
</p>
<p class='text-center'><%= @project.description %></p>
<div class="text-center">
<small>Project created <%= time_ago_in_words @project.created_at %> ago</small>
</div>
<div class="text-center">
<!-- If the user has already created a forum for this project, show it-->
<%if @project.forum %>
<%= link_to forum_path(@project.id), class: "btn btn-info waves-effect waves-classic" do %>
<i class="icon md-comment" aria-hidden="true"></i>Visit the <%= @project.name%> forum!
<% if @project.recent? %>
<span class="badge badge-danger badge-sm">New</span>
<% end %>
<%end%>
<!--If there isn't forum, create it-->
<%else%>
<%= link_to create_forum_path(@project.id), method: :put, class: "btn btn-info waves-effect waves-classic" do %>
<i class="icon md-comment" aria-hidden="true"></i>Create the <%= @project.name%> forum!
<% if @project.recent? %>
<span class="badge badge-danger badge-sm">New</span>
<% end %>
<% end %>
<%end%>
</div>
<div class="text-center request_ownership_wrapper">
</br>
<%= request_ownership_button(@project) %>
</div>
<ul class="nav nav-tabs" role="tablist">
<%= tab_item(:about, "About", active: true ) %>
<%= tab_item(:how_to_start, "How to start") %>
<%= tab_item(:talk_to_the_community, "Talk to the community") %>
<%= tab_item(:setup_your_workspace, "Setup your workspace") %>
<%= tab_item(:deal_with_the_code, "Deal with the code") %>
<%= tab_item(:submit_your_changes, "Submit your changes") %>
<% if @project.owner?(current_user) %>
<div class="nav nav-tabs dropdown float-right">
<button type="button" class="float-right btn btn-primary dropdown-toggle float-right waves-effect waves-classic" id="exampleLeftDropdownSubMenu" aria-expanded="true" data-toggle="dropdown">
Administration menu
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="exampleLeftDropdownSubMenu" role="menu">
<%= link_to "Edit project", edit_project_path(@project), class: "dropdown-item" %>
<%= link_to "Owners", project_users_path(@project), class: "dropdown-item" %>
</div>
</div>
<% end %>
</ul>
</div>
<!--Projects_show_action header ends here. Body content below:-->
<div class="page-content container-fluid tab-content">
<div class="tab-content pt-20">
<% tab_pane(:about, active: true) do %>
<%= render @project.widgets.from_tab(:about ) %>
<% end %>
<% tab_pane(:how_to_start, gridstack: false) do %>
<div class="panel nav-tabs-horizontal" data-plugin="tabs">
<div class="panel-heading">
<h3 class="panel-title">How to start</h3>
</div>
<ul class="nav nav-tabs nav-tabs-line" role="tablist">
<li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#contribution_flow" role="tab">Contribution flow</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#choosing_a_task_to_start_with" role="tab">Choosing a task to start with</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#find_a_mentor" role="tab">Find a mentor</a></li>
</ul>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane active" id="contribution_flow" role="tabpanel">
<p>Please consider following the flow below as it may help you in your first contribution. Tough following is not mandatory, it was tought to guide you as a begginer.
You can move to appropriate guidelines and resources by clicking in the boxes
instead of using the menu.</p>
<%= render 'flow' %>
</div>
<% tab_pane(:choosing_a_task_to_start_with) do %>
<%= render @project.widgets.from_tab(:choosing_a_task_to_start_with) %>
<% end %>
<% tab_pane(:find_a_mentor) do %>
<%= render @project.widgets.from_tab(:find_a_mentor) %>
<% end %>
</div>
</div>
</div>
<% end %>
<% tab_pane(:talk_to_the_community, gridstack: false) do %>
<div class="panel nav-tabs-horizontal" data-plugin="tabs">
<div class="panel-heading">
<h3 class="panel-title">Community support</h3>
</div>
<ul class="nav nav-tabs nav-tabs-line" role="tablist">
<li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#search_before_ask" role="tab">Search before ask</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#synchronous_chat" role="tab">Synchronous chat</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#mailing_lists" role="tab">Mailing lists</a></li>
</ul>
<div class="panel-body">
<div class="tab-content">
<% tab_pane(:search_before_ask, active: true) do %>
<%= render @project.widgets.from_tab(:search_before_ask) %>
<% end %>
<% tab_pane(:synchronous_chat) do %>
<%= render @project.widgets.from_tab(:synchronous_chat) %>
<% end %>
<% tab_pane(:mailing_lists) do %>
<%= render @project.widgets.from_tab(:mailing_lists) %>
<% end %>
</div>
</div>
</div>
<% end %>
<% tab_pane(:setup_your_workspace) do %>
<%= render @project.widgets.from_tab(:setup_your_workspace) %>
<% end %>
<% tab_pane(:deal_with_the_code) do %>
<%= render @project.widgets.from_tab(:deal_with_the_code) %>
<% end %>
<% tab_pane(:submit_your_changes) do %>
<%= render @project.widgets.from_tab(:submit_your_changes) %>
<% end %>
</div>
</div>
......@@ -98,7 +98,7 @@
</div>
<!--Deactivate project-->
<div class="panel">
<div class="panel" id="status" style="margin-bottom: 300px;">
<div class="panel-body">
<div class="col-lg-6 profile-settings-sidebar">
<h4>Deactivate Project:</h4>
......
<%= render 'visitor/header' unless current_user %>
<%= render 'visitor/menu' unless current_user %>
......@@ -15,7 +14,7 @@
<div class="page-content">
<div class="panel ">
<div class="panel-heading">
<h3 class="panel-title"><%= @projects.count %> projects found</h3>
<h3 class="panel-title"><%= @projects.active.count %> projects found</h3>
</div>
<div class="panel-body container-fluid">
......@@ -53,7 +52,7 @@
<table class="table is-indent ">
<table class="table is-indent">
<tbody>
<%= render @projects %>
<%= render @projects.active %>
</tbody>
</table>
</div>
......@@ -64,8 +63,9 @@
<h4>Popular tags</h4>
<div class="list-group list-group-bordered">
<% Tag.first(10).each do |tag| %>
<%= link_to "#{tag} - #{tag.projects.count} results", projects_path(search: tag.to_s), class:"list-group-item" %>
<%if tag.projects.active.count >0%>
<%= link_to "#{tag} - #{tag.projects.count} results", projects_path(search: tag.to_s), class:"list-group-item" %>
<%end%>
<% end %>
</div>
......
<%= render 'visitor/header' unless current_user %>
<%= render 'visitor/menu' unless current_user %>
<%if @project.status == "active"%>
<%= render 'visitor/header' unless current_user %>
<%= render 'visitor/menu' unless current_user %>
<div id="<%= @project.id %>" class="page-header page-header-bordered page-header-tabs nav-tabs-horizontal" data-plugin="tabs">
<%= render 'notices' %>
<figure class='logo-projeto text-center'>
<img class=" img-responsive" src="<%= @project.image_url %>"
style="max-width:250px;"/>
</figure>
<h1 class="page-title text-center"><%= @project.name %>
<% if @project.recent? %>
<span class="badge badge-danger badge-sm">New</span>
<% end %>
</h1>
<p class="tags text-center">
<% @project.tags.each do |tag| %>
<%= link_to projects_path(search: tag.to_s) do %>
<span class="badge badge-outline badge-primary"><%=tag.to_s%></span>
<% end %>
<% end %>
</p>
<p class='text-center'><%= @project.description %></p>
<div class="text-center">
<small>Project created <%= time_ago_in_words @project.created_at %> ago</small>
</div>
<div class="text-center">
<!-- If the user has already created a forum for this project, show it-->
<%if @project.forum %>
<%= link_to forum_path(@project.id), class: "btn btn-info waves-effect waves-classic" do %>
<i class="icon md-comment" aria-hidden="true"></i>Visit the <%= @project.name%> forum!
<% if @project.recent? %>
<span class="badge badge-danger badge-sm">New</span>
<% end %>
<%end%>
<!--If there isn't forum, create it-->
<%else%>
<%= link_to create_forum_path(@project.id), method: :put, class: "btn btn-info waves-effect waves-classic" do %>
<i class="icon md-comment" aria-hidden="true"></i>Create the <%= @project.name%> forum!
<% if @project.recent? %>
<span class="badge badge-danger badge-sm">New</span>
<% end %>
<% end %>
<%end%>
</div>
<div class="text-center request_ownership_wrapper">
</br>
<%= request_ownership_button(@project) %>
</div>
<ul class="nav nav-tabs" role="tablist">
<%= tab_item(:about, "About", active: true ) %>
<%= tab_item(:how_to_start, "How to start") %>
<%= tab_item(:talk_to_the_community, "Talk to the community") %>
<%= tab_item(:setup_your_workspace, "Setup your workspace") %>
<%= tab_item(:deal_with_the_code, "Deal with the code") %>
<%= tab_item(:submit_your_changes, "Submit your changes") %>
<% if @project.owner?(current_user) %>
<div class="nav nav-tabs dropdown float-right">
<button type="button" class="float-right btn btn-primary dropdown-toggle float-right waves-effect waves-classic" aria-expanded="true" data-toggle="dropdown">
Administration menu
</button>
<div class="dropdown-menu dropdown-menu-right" role="menu">
<%= link_to "Edit project", edit_project_path(@project), class: "dropdown-item" %>
<%= link_to "Owners", project_users_path(@project), class: "dropdown-item" %>
<a href="<%=edit_project_path(@project)%>#status" class="dropdown-item">Deactivate project</a>
</div>
</div>
<% end %>
</ul>
</div>
<!--Projects_show_action header ends here. Body content below:-->
<div id="<%= @project.id %>" class="page-header page-header-bordered page-header-tabs nav-tabs-horizontal" data-plugin="tabs">
<div class="page-content container-fluid tab-content">
<div class="tab-content pt-20">
<% tab_pane(:about, active: true) do %>
<%= render @project.widgets.from_tab(:about ) %>
<% end %>
<% tab_pane(:how_to_start, gridstack: false) do %>
<div class="panel nav-tabs-horizontal" data-plugin="tabs">
<div class="panel-heading">
<h3 class="panel-title">How to start</h3>
</div>
<ul class="nav nav-tabs nav-tabs-line" role="tablist">
<li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#contribution_flow" role="tab">Contribution flow</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#choosing_a_task_to_start_with" role="tab">Choosing a task to start with</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#find_a_mentor" role="tab">Find a mentor</a></li>
</ul>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane active" id="contribution_flow" role="tabpanel">
<p>Please consider following the flow below as it may help you in your first contribution. Tough following is not mandatory, it was tought to guide you as a begginer.
You can move to appropriate guidelines and resources by clicking in the boxes
instead of using the menu.</p>
<%= render 'flow' %>
</div>
<% tab_pane(:choosing_a_task_to_start_with) do %>
<%= render @project.widgets.from_tab(:choosing_a_task_to_start_with) %>
<% end %>
<% tab_pane(:find_a_mentor) do %>
<%= render @project.widgets.from_tab(:find_a_mentor) %>
<% end %>
</div>
</div>
</div>
<% end %>
<% tab_pane(:talk_to_the_community, gridstack: false) do %>
<div class="panel nav-tabs-horizontal" data-plugin="tabs">
<div class="panel-heading">
<h3 class="panel-title">Community support</h3>
</div>
<ul class="nav nav-tabs nav-tabs-line" role="tablist">
<li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#search_before_ask" role="tab">Search before ask</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#synchronous_chat" role="tab">Synchronous chat</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#mailing_lists" role="tab">Mailing lists</a></li>
</ul>
<div class="panel-body">
<div class="tab-content">
<% tab_pane(:search_before_ask, active: true) do %>
<%= render @project.widgets.from_tab(:search_before_ask) %>
<% end %>
<% tab_pane(:synchronous_chat) do %>
<%= render @project.widgets.from_tab(:synchronous_chat) %>
<% end %>
<% tab_pane(:mailing_lists) do %>
<%= render @project.widgets.from_tab(:mailing_lists) %>
<% end %>
</div>
</div>
</div>
<% end %>
<% tab_pane(:setup_your_workspace) do %>
<%= render @project.widgets.from_tab(:setup_your_workspace) %>
<% end %>
<% tab_pane(:deal_with_the_code) do %>
<%= render @project.widgets.from_tab(:deal_with_the_code) %>
<% end %>
<% tab_pane(:submit_your_changes) do %>
<%= render @project.widgets.from_tab(:submit_your_changes) %>
<% end %>
</div>
</div>
<!--Presenting info abou an inactive project\-->
<%else%>
<%= render 'visitor/header' unless current_user %>
<%= render 'visitor/menu' unless current_user %>
<div id="<%= @project.id %>" class="page-header page-header-bordered page-header-tabs nav-tabs-horizontal" data-plugin="tabs">
<%= render 'notices' %>
<figure class='logo-projeto text-center'>
<img class=" img-responsive" src="<%= @project.image_url %>"
......@@ -20,143 +185,37 @@
<% end %>
<% end %>
</p>
<p class='text-center'><%= @project.description %></p>
<div class="text-center">
<small>Project created <%= time_ago_in_words @project.created_at %> ago</small>
</div>
<div class="nav nav-tabs float-right" role="tablist">
<div class="text-center">
<!-- If the user has already created a forum for this project, show it-->
<%if @project.forum %>
<%= link_to forum_path(@project.id), class: "btn btn-info waves-effect waves-classic" do %>
<i class="icon md-comment" aria-hidden="true"></i>Visit the <%= @project.name%> forum!
<% if @project.recent? %>
<span class="badge badge-danger badge-sm">New</span>
<% end %>
<%end%>
<!--If there isn't forum, create it-->
<%else%>
<%= link_to create_forum_path(@project.id), method: :put, class: "btn btn-info waves-effect waves-classic" do %>
<i class="icon md-comment" aria-hidden="true"></i>Create the <%= @project.name%> forum!
<% if @project.recent? %>
<span class="badge badge-danger badge-sm">New</span>
<% end %>
<% end %>
<%end%>
</div>
<div class="text-center request_ownership_wrapper">
</br>
<%= request_ownership_button(@project) %>
</div>
<ul class="nav nav-tabs" role="tablist">
<%= tab_item(:about, "About", active: true ) %>
<%= tab_item(:how_to_start, "How to start") %>
<%= tab_item(:talk_to_the_community, "Talk to the community") %>
<%= tab_item(:setup_your_workspace, "Setup your workspace") %>
<%= tab_item(:deal_with_the_code, "Deal with the code") %>
<%= tab_item(:submit_your_changes, "Submit your changes") %>
<% if @project.owner?(current_user) %>
<div class="nav nav-tabs dropdown float-right">
<button type="button" class="float-right btn btn-primary dropdown-toggle float-right waves-effect waves-classic" id="exampleLeftDropdownSubMenu" aria-expanded="true" data-toggle="dropdown">
<div class="nav nav-tabs dropdown">
<button type="button" class="float-right btn btn-primary dropdown-toggle float-right waves-effect waves-classic" aria-expanded="true" data-toggle="dropdown">
Administration menu
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="exampleLeftDropdownSubMenu" role="menu">
<div class="dropdown-menu dropdown-menu-right" role="menu">
<%= link_to "Edit project", edit_project_path(@project), class: "dropdown-item" %>
<%= link_to "Owners", project_users_path(@project), class: "dropdown-item" %>
<a href="<%=edit_project_path(@project)%>#status" class="dropdown-item">Activate project</a>
</div>
</div>
<% end %>
</ul>
</div>
</div>
<!--Projects_show_action header ends here. Body content below:-->
<div class="page-content container-fluid tab-content">
<div class="tab-content pt-20">
<% tab_pane(:about, active: true) do %>
<%= render @project.widgets.from_tab(:about ) %>
<% end %>
<% tab_pane(:how_to_start, gridstack: false) do %>
<div class="panel nav-tabs-horizontal" data-plugin="tabs">
<div class="panel-heading">
<h3 class="panel-title">How to start</h3>
</div>
<ul class="nav nav-tabs nav-tabs-line" role="tablist">
<li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#contribution_flow" role="tab">Contribution flow</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#choosing_a_task_to_start_with" role="tab">Choosing a task to start with</a></li>
<li class="nav-item"><a class="nav-link" data-toggle="tab" href="#find_a_mentor" role="tab">Find a mentor</a></li>
</ul>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane active" id="contribution_flow" role="tabpanel">
<p>Please consider following the flow below as it may help you in your first contribution. Tough following is not mandatory, it was tought to guide you as a begginer.
You can move to appropriate guidelines and resources by clicking in the boxes
instead of using the menu.</p>
<%= render 'flow' %>
</div>
<% tab_pane(:choosing_a_task_to_start_with) do %>
<%= render @project.widgets.from_tab(:choosing_a_task_to_start_with) %>
<% end %>
<% tab_pane(:find_a_mentor) do %>
<%= render @project.widgets.from_tab(:find_a_mentor) %>
<% end %>
</div>
</div>
</div>
<% end %>
<% tab_pane(:talk_to_the_community, gridstack: false) do %>
<div class="panel nav-tabs-horizontal" data-plugin="tabs">
<div class="panel-heading">
<h3 class="panel-title">Community support</h3>