Top Menu

Jump to content
Home
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?

      or sign in with your existing account

      OpenProject ID Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

Development
  1. OpenProject
  2. Forums
  3. Development
  4. Adding new block in "My Page"

Adding new block in "My Page"

Added by Jörg Delker over 10 years ago

My environment: OpenProject 4.0.6 (installed on CentOS 6 from provided openproject-ce package)

I would like to add a new customized block to the available blocks list in “My Page”.
As suggested in EDITING PLUGINS, I followed the advise to copy the openproject-my_project_page plugin from ./vendored-plugins to ./plugins to add my customizations.

Unfortunately, I’m not successful to see any of my changes become active.
That may because I’m simply doing something fundamental wrong…

This is what I did:

  1. copy ./vendored-plugins/openproject-my_project_page to ./plugins
  2. changed the plugin entry in Gemfiles.plugins to gem "openproject-my_project_page", :path => "plugins/openproject-my_project_page"
  3. added a new block as plugins/openproject-my_project_page/app/views/my_projects_overviews/blocks/_work_packages_waiting_for_me.html.erb
  4. added locale entries for label_work_packages_waiting_for_me to config/locales/*.yml

Then I invoked

  1. openproject-ce run bundle install --no-deployment
  2. service openproject-ce restart

After that I would’ve expected to see the added block in the MyPage Edit Page (/my/page_layout).
But that’s not the case. Actually, nothing changed at all.

What am I doing wrong here?

Cheers
Jörg


Replies (4)

RE: Adding new block in "My Page" - Added by Jonas Heinrich (Finn) over 10 years ago

H Jörg,

I think you have the .erb in the wrong path. It should be: vendored-plugins/openproject-my_project_page/app/views/my/blocks/ (‘my’ instead of ‘my_projects_overviews’).

Furthermore, you could check if your version of the plugin is used via openproject-ce run bundle show openproject-my_project_page.

And finally, if you think that this block is a good piece of code you could create a pull request against our github-repository. We are happy about every contribution. :)

Best,

Jonas

RE: Adding new block in "My Page" - Added by Jörg Delker over 10 years ago

Hi Jonas,

thanks for responding and the good hint.

Unfortunately, there is no documentation on development of custom content-blocks, so some reverse engineering was necessary.
(Which is kind of hard, with very limited ruby background…)

While I figured from one of the vendered plugin code elements that custom content-blocks for the “project overview” page are expected in app/views/my_project_overviews/blocks/_my_custom_block.erb, I didn’t find the code that looks for the “My page” content blocks.

However, you gave the hint to place those in app/views/my/blocks/_my_custom_block.erb, which worked perfectly.

My code is available here.
Pull request is coming up.

Disclaimer: This is my 1st ruby code so far, so bare with me. It purely results from looking at other code and counting 1 and 1 together.
If this could be implemented much more elegant, feel free to fork and improve - I like to learn from that!

RE: Adding new block in "My Page" - Added by Jonas Heinrich (Finn) over 10 years ago

Hi Jörg,

yes, it is unfortunately that we do not have enough documentation. We try to fix that. Or, if you have mastered this riddle by now, you could create a short documentation. :)

Btw, your code looks good to me so far :+1:

I think I now found out what is the main cause for (my) confusion: There is a difference between my-project-page and the my-page. You probably know the following. But to be sure I just write it down again.

  • The my-page is sort of global and shows information about your account.
  • Whereas the my-project-page is bound to a project. That means that a block that is added in app/views/my_project_overviews/blocks will be selectable when you personalize a project page. To see this, go to a project and click personalize this page on the upper right.

That leads to the following places to store blocks:

  • Blocks for my-page in my/blocks (see the code here)
  • Blocks for my-project-page in my_project_overview/blocks (see the code here)

Unfortunately, if you want to create pull request then you can only create one against OpenProject or against OpenProject-My_Project_Overview. So you would have to split your repository up. You can find a more detailed explanation here. That way, your blocks would automatically be in the community edition.

Or maybe you want to add this as it is: as a plugin. But right now, I’m not sure how we would handle it. We are thinking about doing more with rubygems.

So it may be possible to kind of release it as a plugin. But for now it would be easier to include into the existing repositories. What do you think?

Best,

Jonas

RE: Adding new block in "My Page" - Added by Jörg Delker over 10 years ago

Hi Jonas,

thanks for summarizing the facts again. I recon that we had the same “confusion” here ;)

And thanks again for your mind-reading about the pull request. I’ve broke my head about that exact problem.

For now, I decided to leave this as a single external plugin and postpone the pull request.
In it’s current state, the code would probably not fit very well in the community edition anyhow, because the type of workpackages that are evaluated is hard-coded (due to my lack of knowledge how to implement a plugin config page yet).

As soon as I’ve found a clue on that and made that types configurable, I’ll probably fork the particular community-edition repos and transplant the code.
Then a pull request will be easy.

Thanks for your support,

Jörg

  • (1 - 4/4)
Loading...