Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move group issues list into their own controller.
- Loading branch information
Showing
5 changed files
with
59 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Note inheritance | ||
class Group::IssuesController < IssuesController | ||
filter_access_to :all, context: :issues | ||
|
||
def index | ||
set_page_title t(".title", group_name: current_group.name) | ||
|
||
# FIXME: bad design, @query is set by search action | ||
if @query | ||
issues = Issue.intersects(current_group.profile.location).find_with_index(@query) | ||
else | ||
issues = Issue.intersects(current_group.profile.location).by_most_recent.paginate(page: params[:page]) | ||
end | ||
|
||
@issues = IssueDecorator.decorate(issues) | ||
@start_location = index_start_location | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Note inheritance | ||
class Group::MessageThreadsController < MessageThreadsController | ||
before_filter :load_group | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require "spec_helper" | ||
|
||
describe "Issues in a group subdomain" do | ||
include_context "signed in as a group member" | ||
include_context "with current group subdomain" | ||
|
||
let!(:group_profile) { FactoryGirl.create(:big_group_profile, group: current_group) } | ||
|
||
context "index" do | ||
let(:location_inside_group) { "POINT (10 10)" } | ||
let(:location_outside_group) { "POINT (200 200)" } | ||
let!(:issues) { FactoryGirl.create_list(:issue, 2, location: location_inside_group) } | ||
let(:outside_issue) { FactoryGirl.create(:issue, location: location_outside_group) } | ||
|
||
it "should show issues in the group's area" do | ||
visit issues_path | ||
issues.each do |issue| | ||
page.should have_content(issue.title) | ||
end | ||
end | ||
|
||
it "should not show issues outside the group's area" do | ||
outside_issue | ||
visit issues_path | ||
page.should have_no_content(outside_issue.title) | ||
end | ||
|
||
it "should set the page title" do | ||
visit issues_path | ||
page.should have_selector("title", content: I18n.t("group.issues.index.title", group_name: current_group.name)) | ||
end | ||
end | ||
end |