biow0lf / redmine_landing_page

Landing Page plugin for redmine
http://www.redmine.org/plugins/landing_page
33 stars 25 forks source link

Feature: view overview page #7

Open logical-and opened 12 years ago

logical-and commented 12 years ago

That would be great, if plugin had option per project - show the overview page or not, so if the option enabled - redirect to url, but if user comes from, for ex. issues, show overview page.

I know, it maybe really hard, because the plugin must, rewrite the overview page url (double url - from the project, from the other url) or something like that, but it would be really cool feature.

What you thinking about? Thanks.

srathbun commented 12 years ago

Updated my pull request to include a commit adding this feature. I may add a check box to turn this feature on and off, but that requires editing several different bits, not just the if statement.

logical-and commented 12 years ago

@srathbun Thanks for your idea. I see that statement wrong. I found this solution after debugging:

if @project.landing_page && !@project.landing_page.empty? && request.env["HTTP_REFERER"] && !(request.env["HTTP_REFERER"].scan(@project.identifier).length > 0)
              redirect_to @project.landing_page, :status => 302
if @project.landing_page && !@project.landing_page.empty? && !(request.env["HTTP_REFERER"].scan(@project.name).length > 0)
               redirect_to @project.landing_page, :status => 302
srathbun commented 12 years ago

Ah, right @project.identifier is the correct value. Why are you checking that request.env["HTTP_REFERER"] exists though? I've updated my pull request with the proper check.

logical-and commented 12 years ago

/project/my-project can be direct link to project. In that case request.env value === nil, and statement fails (500 error - no method scan for nil). I am not ruby programmer, and got this point after debugging. Is it normal situation or environment specific issue?

srathbun commented 12 years ago

Ah yes, if the referer is not being filled in then we can't do string manipulation on it. So for a proper result, we can just ignore the referer check and dump them to the landing page if they come from outside the project. The landing page is supposed to be the first page external people see, and we only want to get to the overview page from inside the project itself.

I've added another commit to fix the bug.

logical-and commented 12 years ago

Yes, you right, more complicated if statement.

I found another bug - we cant go to overview from issue, because issue url does not contain project identifier: http://redmine/issues/357 Not sure, that can be fixed.

srathbun commented 12 years ago

That's because issues technically aren't part of any individual project, which is why you can create issue 1 on project a and then create issue 2 on project b.

As such, we can't know "which" project we are on when the user requests the overview page. We might be able to assume that the overview page is probably linked to the current project, but then how will we know if the user is clicking the overview button, or just a random link from the same IP address?

logical-and commented 12 years ago

I think it can be resolved by cookies, for example. But, it is the complicated resolution, so we can leave it as it is. According to this issue, one feature left - checkbox.

nbnew25 commented 9 years ago

Plugin is very good. I install success with Redmine 2.6. But I don't open overview tab, if project was set landing page