Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding filter for tags #379

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ccaa53a
Adding project requirements page, fixes #341.
Feb 17, 2015
927a3a7
adding support for differentiating between upcoming and past events i…
alexshook Feb 21, 2015
b4d0992
Change language in events show template button and text from 'RSVP' a…
alexshook Feb 21, 2015
065e4b8
Change listing in events index template to include a 'Past Events' he…
alexshook Feb 21, 2015
5fe0634
show event start date for past events
alexshook Feb 21, 2015
c15737c
update event methods for consistency
alexshook Feb 25, 2015
88dfb5e
move Past Events heading styling to stylesheets folder
alexshook Feb 25, 2015
88063e7
Create beta_signups for users
courte Feb 27, 2015
c88ae18
Added all projects button to navigation
rachelmad Feb 28, 2015
d7d4eae
Link to issue template & include requisite emojis in the README
courte Mar 10, 2015
b80c7e0
Added a helper method to return tech and causes tag names.
ADStrovers Mar 25, 2015
973aa46
Changes to helper and added variables for lists to the controller. W…
ADStrovers Mar 25, 2015
a445db4
Small typo fix.
ADStrovers Mar 25, 2015
0ff66fd
Added helper to created form
ADStrovers Mar 25, 2015
94a1cc4
Working state for helper and controller for returning a sorted tag list
ADStrovers Mar 25, 2015
078a9fe
Added javascript for adding links to radio buttons.
ADStrovers Mar 25, 2015
8ea15db
Added extra divs to partial to clean up HTML and added partial render…
ADStrovers Mar 25, 2015
d308cf2
Added basic styling for tag list bars.
ADStrovers Mar 25, 2015
bb9c735
Cleaning up files for hound.
ADStrovers Apr 6, 2015
5691ece
fixes scope of projects.js function.
ADStrovers Apr 6, 2015
048295a
Removes erroneous clasing paranthesis from javascript file.
ADStrovers Apr 9, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ Join our mission to create superhero coders! You can get involved by taking any
1. [Register for CodeMontage](http://codemontage.com/auth/github).
2. [Follow us on Twitter](http://twitter.com/CodeMontage).
3. Be the change you wish to see by [creating a branch](http://guides.github.com/overviews/flow) submitting a [pull request](https://github.com/CodeMontageHQ/codemontage/pulls/new) to improve the platform. *Please include a screenshot of any user interface changes with all pull requests.*
4. Suggest an improvement by opening an [issue](https://github.com/CodeMontageHQ/codemontage/issues/new).
(We recommend including [emojis](http://www.emoji-cheat-sheet.com) for maximum effectiveness.)
4. Suggest an improvement by opening an [issue](https://github.com/CodeMontageHQ/codemontage/issues/new). Please follow [our issue template](https://github.com/CodeMontageHQ/codemontage/issues/347) and use multiple [emojis](http://www.emoji-cheat-sheet.com) for maximum effectiveness. :+1::100::wink:
5. Reach out to us at [email protected].


Expand Down
18 changes: 18 additions & 0 deletions app/assets/javascripts/projects.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
window.onload = function() {
var tags = [];
var href = window.location.origin + window.location.pathname

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon.

console.log(href)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon.
'console' is not defined.


tags = document.getElementsByClassName("tag_radio");

for (i = 0; i < tags.length; i++) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'i' is not defined.

tags[i].addEventListener("click", function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'i' is not defined.

if (this.value === "all") {
window.location.href = href;
} else {
window.location.href = href +"?tags=" + this.value;
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary semicolon.

});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't make functions within a loop.

};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary semicolon.


};
4 changes: 4 additions & 0 deletions app/assets/stylesheets/events.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@
.check-in {
margin-top:25px;
}

.top-25 {
padding-top: 25px;
}
18 changes: 18 additions & 0 deletions app/assets/stylesheets/projects.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,21 @@ h5 span.favorite {
.project_links {
margin-bottom: 6%;
}

.tag_list {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Selector tag_list should be written in lowercase with hyphens

border-radius: 5px;
color: #fff;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color literals like #fff should only be used in variable declarations; they should be referred to via variable everywhere else.

padding: 10px;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properties should be ordered border-radius, color, margin-bottom, overflow-x, overflow-y, padding, white-space

margin-bottom: 0;
overflow-x: scroll;
overflow-y: hidden;
white-space: nowrap;

div {
display: inline-block;
padding-right: 10px;
}
}

.purple { background-color: $cmPurple; }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name of variable cmPurple should be written in all lowercase letters with hyphens instead of underscores

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ignored this comment as that is how the variable is set currently in the project.

.teal { background-color: $cmTeal; }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files should end with a trailing newline
Name of variable cmTeal should be written in all lowercase letters with hyphens instead of underscores
Opening curly brace { should be preceded by one space

3 changes: 2 additions & 1 deletion app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ def create
end

def index
@events = Event.public_events.order("start_date desc")
@upcoming_events = Event.upcoming_events.public_events.order("start_date desc")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [83/80]

@past_events = Event.past_events.public_events.order("start_date desc")
end

def show
Expand Down
1 change: 1 addition & 0 deletions app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def index
else
Project.featured
end.with_technologies_and_causes.with_organization
@tech_list, @cause_list = view_context.projects_tech_and_cause_tags_lists(@featured_projects)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [97/80]

end

def show
Expand Down
20 changes: 20 additions & 0 deletions app/helpers/project_controller_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,24 @@ def project_tags_link_list(project, type)
link_to tag.name, projects_path(tags: tag.name)
end.join(', ').html_safe
end

def projects_tech_and_cause_tags_lists(projects_array)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assignment Branch Condition size for projects_tech_and_cause_tags_lists is too high. [15.26/15]

technologies = []
causes = []

projects_array.each do |project|
project.technologies.each do |tech|
unless technologies.include? tech.name
technologies << tech.name
end
end
project.causes.each do |cause|
unless causes.include? cause.name
causes << cause.name
end
end
end

return technologies.sort, causes.sort
end
end
5 changes: 5 additions & 0 deletions app/models/beta_signup.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class BetaSignup < ActiveRecord::Base
belongs_to :user

validates :user_id, uniqueness: true
end
9 changes: 9 additions & 0 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Event < ActiveRecord::Base
friendly_id :name, use: :slugged

scope :upcoming_events, -> { where("end_date >= ?", Time.now) }
scope :past_events, -> { where("end_date < ?", Time.now) }
scope :public_events, -> { where(is_public: true) }

def self.featured
Expand Down Expand Up @@ -114,6 +115,14 @@ def fetch_engagement_stats
stats
end

def upcoming?
true if end_date >= Time.now
end

def past?
true if end_date < Time.now
end

private

def delete_logo
Expand Down
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class User < ActiveRecord::Base

has_many :services
has_one :profile, class_name: 'UserProfile'
has_one :beta_signup
delegate :gravatar_email, :headline, :is_coder, :name, :represents_org, :represents_team, :cause_list, :technology_list, :email_news, :email_training, to: :profile

validates_presence_of :password, on: :create # will only run on account creation
Expand Down
16 changes: 14 additions & 2 deletions app/views/events/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,27 @@
<div>
<h4>Events</h4>

<% if @events.present? %>
<% if @upcoming_events.present? %>
<p>Join us online or in-person at these upcoming events to build open source and change the world:</p>

<div class="events">
<% @events.each do |event| %>
<% @upcoming_events.each do |event| %>
<div class="large-10 centered">
<h5><%= link_to event.name + " - " + event.start_date.strftime("%B %d, %Y"), event_path(event) %></h5>
</div>

<% end %>

<% if @past_events.present? %>
<h4 class="top-25">Past Events</h4>

<% @past_events.each do |event| %>
<div class="large-10 centered">
<h5><%= link_to event.name + " - " + event.start_date.strftime("%B %d, %Y"), event_path(event) %></h5>
</div>

<% end %>
<% end %>
</div>
<% else %>
<p>Oops! We can't seem to find any events. <%= link_to "Jump into a project", projects_path %>, or <%= link_to "reach out to an organization", organizations_path %> directly.</p>
Expand All @@ -23,3 +34,4 @@
<%= render "check_in_prompt" %>
<% end %>
</div>

36 changes: 24 additions & 12 deletions app/views/events/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,26 @@

<div id="event_rsvp_top" class="row">
<div class="large-10 columns large-centered text-center">
<%= %>
<% if @event.eventbrite_url.present? %>
<%= link_to "RSVP for the " + @event.name, @event.eventbrite_url, :class => "large index radius button" %>
<%= %>
<% if @event.upcoming? %>
<% if @event.eventbrite_url.present? %>
<%= link_to "RSVP for the " + @event.name, @event.eventbrite_url, :class => "large index radius button" %>
<% else %>
<%= link_to "Join the " + @event.name, dashboard_path, :class => "large index radius button" %>
<% end %>
<% else %>
<%= link_to "Join the " + @event.name, dashboard_path, :class => "large index radius button" %>
<%= link_to "Too late! View More Events", events_path, :class => "large index radius button" %>
<% end %>
</div>
</div>

<div>
<p class="text-center"><strong>Join us <%= @event.start_date.strftime("%B %d, %Y") %> for the </strong></p>
</div>
<% if @event.upcoming? %>
<div>
<p class="text-center"><strong>Join us <%= @event.start_date.strftime("%B %d, %Y") %> for the </strong></p>
</div>
<% else %>
<p class="text-center"><strong><%= @event.start_date.strftime("%B %d, %Y") %></strong></p>
<% end %>

<div class="large-10 columns large-centered text-center">
<h1><%= @event.name %></h1>
Expand Down Expand Up @@ -66,11 +74,15 @@
<div id="event_rsvp_bottom" class="row">
<div class="large-6 columns large-centered text-center">
<%= %>
<% if @event.eventbrite_url.present? %>
<%= link_to "RSVP for the " + @event.name, @event.eventbrite_url, :class => "large index radius button" %>
<% else %>
<%= link_to "Join the " + @event.name, dashboard_path, :class => "large index radius button" %>
<% end %>
<% if @event.upcoming? %>
<% if @event.eventbrite_url.present? %>
<%= link_to "RSVP for the " + @event.name, @event.eventbrite_url, :class => "large index radius button" %>
<% else %>
<%= link_to "Join the " + @event.name, dashboard_path, :class => "large index radius button" %>
<% end %>
<% else %>
<%= link_to "Too late! View More Events", events_path, :class => "large index radius button" %>
<% end %>
</div>
</div>

Expand Down
38 changes: 38 additions & 0 deletions app/views/home/project_requirements.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<div id="project_requirements">
<div class="row">
<h2>Project Requirements</h2>
<p>Wanting to partner with CodeMontage and become one of our <%= link_to "featured projects", projects_path %>? Here are some guidelines we look for and simple suggestions on what we consider best practices for all of our projects.</p>
</div>
<div class="row" id="open_source">
<h3>Open Source</h3>
<p>At CodeMontage, we strive for the projects we work on to have as much transparency to the public as possible. This leads us to make open source projects a requirement for any of our featured projects.</p>
<p><strong>What is considered an open source project?</strong> Open source software is software that can be freely viewed, used, changed, and shared (in modified or unmodified form) by anyone.</p>
</div>
<div class="row" id="leadership">
<h3>Leadership</h3>
<p>The most successful open source projects have stemmed from a healthy community surrounding it. Some of these projects may have a specific foundation (e.g. jQuery, Django) that supplies the leadership to help maintain the code base. We do not require that a project have a foundation or larger organization surround the project, but merely a consistent group (or individual) who helps keep the project fresh and serves as the main point of contact.</p>
</div>
<div class="row" id="issue_tracker">
<h3>Issue Tracker</h3>
<p>Being able to organize and track issues surrounding the development of a project is a great way to help onboard new developers. GitHub issues, Trac and other systems are acceptable forms of issue management. We require this so that our members are better able to understand how to contribute to the code base.</p>
</div>
<div class="row" id="up_to_date">
<h3>Up-To-Date Code Base</h3>
<p>Consistent management of the code base helps a project stay fresh and well organized. If a project has not been committed to in six months or over, CodeMontage considers it a stale project and is not considered something our members can easily contribute to. However, there may be exceptions to this and project owners are welcome to connect with us at <%= mail_to "[email protected]", "[email protected]", :subject => "Connecting with CodeMontage", :target => '_blank' %> to discuss further.</p>
</div>
<div class="row" id="licensing">
<h3>Licensing</h3>
<p>Choosing a license for your open source project is a crucial part to becoming a solid code base. It helps direct users how they are legally able to use and distribute the code in the project. We request that all projects have a license in order for us to recommend it to our members. Here is a helpful link that explains some of the more popular licensing options: <%= link_to "http://choosealicense.com/", "http://choosealicense.com/" %>.</p>
<p>
<em>DISCLAIMER: We are not lawyers. Please consult legal counsel regarding questions about these licensing options.</em>
</p>
</div>
<div class="row" id="social_impact">
<h3>Social Impact</h3>
<p>CodeMontage’s mission is to “improve yourself while improving the world.” Within this context, we require that our featured projects have a direct social impact on the world and help further the advancement of various aspects of the human race, the planet and social good throughout the world. It is our goal to focus on featured projects who provide this level of impact either directly or indirectly to the global community.</p>
</div>
<div class="row">
<h5>Questions?</h5>
<p>Feel free to reach out to us at <%= mail_to "[email protected]", "[email protected]", :subject => "CodeMontage Project Requirement Questions", :target => '_blank' %>. We look forward to hearing from you!</p>
</div>
</div>
8 changes: 7 additions & 1 deletion app/views/layouts/_navigation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
</ul>
<section class="top-bar-section">
<ul class="left">
<li><%= link_to "Projects", projects_path %></li>
<li class="has-dropdown">
<%= link_to "Projects", projects_path %>
<ul class="dropdown">
<li><%= link_to "All Projects", projects_path %>
<li><%= link_to "Project Requirements", project_requirements_path %></li>
</ul>
</li>
<li><%= link_to "Jobs", jobs_path %></li>
<li class="has-dropdown"><%= link_to "Events", events_path %>
<ul class="dropdown">
Expand Down
6 changes: 6 additions & 0 deletions app/views/projects/_tags_list.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<form class="tag_list <%= color %>">
<div><input type="radio" name="tags" class="tag_radio" value="all">All</input></div>
<%- tag_list.each do |tech| %>
<div><input type="radio" name="tags" class="tag_radio" value="<%= tech %>"><%= "#{tech}" %></input></div>
<%- end -%>
</form>
5 changes: 4 additions & 1 deletion app/views/projects/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<% if @featured_projects.present? %>
<p>These open source, community-driven projects are making the world better and could really use your help. Check them out and contribute however you'd like. Or, view <%= link_to "organizations", organizations_path %>.
Excited to contribute, but can't dig in right now? <%= link_to "Code Later", code_later_url %>!</p>


<%= render partial: 'tags_list', locals: { tag_list: @tech_list, color: "purple" } %>
<%= render partial: 'tags_list', locals: { tag_list: @cause_list, color: "teal" } %>

<% @featured_projects.each do |project| %>
<%= render partial: 'project', locals: { project: project } %>
<% end %>
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
get '/our_services', controller: 'home', action: 'services'
get '/resources', controller: 'home', action: 'resources'
get '/training', controller: 'home', action: 'training'
get '/project_requirements', controller: 'home',
action: 'project_requirements'

# Blog
get '/blog' => redirect('http://blog.codemontage.com')
Expand Down
10 changes: 10 additions & 0 deletions db/migrate/20150227190642_create_beta_signups.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateBetaSignups < ActiveRecord::Migration
def change
create_table :beta_signups do |t|
t.references :user
t.timestamps
end

add_index :beta_signups, :user_id
end
end
10 changes: 9 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 to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20150213195324) do
ActiveRecord::Schema.define(:version => 20150227190642) do

create_table "active_admin_comments", :force => true do |t|
t.string "namespace"
Expand All @@ -27,6 +27,14 @@
add_index "active_admin_comments", ["namespace"], :name => "index_active_admin_comments_on_namespace"
add_index "active_admin_comments", ["resource_type", "resource_id"], :name => "index_active_admin_comments_on_resource_type_and_resource_id"

create_table "beta_signups", :force => true do |t|
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end

add_index "beta_signups", ["user_id"], :name => "index_beta_signups_on_user_id"

create_table "event_registrations", :force => true do |t|
t.integer "event_id", :null => false
t.integer "user_id", :null => false
Expand Down