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

Implement theme options #1739

Closed
4 of 7 tasks
NateWr opened this issue Aug 18, 2016 · 11 comments
Closed
4 of 7 tasks

Implement theme options #1739

NateWr opened this issue Aug 18, 2016 · 11 comments
Assignees
Milestone

Comments

@NateWr
Copy link
Contributor

NateWr commented Aug 18, 2016

An issue to track work on a theme options API.

  • Implement API to add options, with fields generated automatically and an API for accessing options.
  • Default theme: add font selections
  • Default theme: add color picker
  • Bootstrap theme: add theme selector
  • Bootstrap theme: add color pickers which match bootstrap variables
  • Document API
  • Extend with more field types

Related but not planned to be part of the theme options API: #787

@NateWr NateWr added this to the OJS 3.0 milestone Aug 18, 2016
@NateWr NateWr self-assigned this Aug 18, 2016
@asmecher
Copy link
Member

@NateWr, mind summarizing the PRs here? I'll take a look at the linting issue etc.

@NateWr
Copy link
Contributor Author

NateWr commented Aug 25, 2016

The new theme options API is a set of methods on the ThemePlugin class. It's still very nascent and could use a lot of building out of its feature-set.

  • Added a hook to PluginRegistry::loadCategory() which fires after a category has been loaded. This allows themes to be intialized after the load, so that parent/child themes are aware of each other regardless of when they appear in the load order.
  • Add addOption() and getOption() methods on the ThemePlugin class intended to be used by themes.
  • Add methods to the ThemePlugin class which allow it to tie into Form hooks for readUserVars() and execute().
  • Added hooks for the appearance form and site settings form. This required loading the themes when the form is instantiated (so that hooks are registered before being fired), so it's not generalizable in the way I'd like.
  • Clear template and CSS cache when a theme option is updated.
  • Adjusted the themes.tpl template used for selecting a theme. Now the appearance and site settings forms will load theme options related to the currently active theme. If a theme is switched, a new ThemeOptionsHandler.js will remove the theme options but it doesn't yet fetch the ones for the new theme (this is really rough but will work to get some basic options in for 3.0).
  • Theme options only support text, radio and color field types at the moment.
  • A new gitmodule was added for spectre, a simple color picker (the one in your browser's devtools) which falls back to the HTML5 color input if supported.
  • The default theme was given typography and color options. The bootstrap3 theme now includes a selector to choose one of the bundled sub-themes.

Once we can get the OJS tests passing, I'll submit PRs for pkp-lib and OMP too.

@NateWr
Copy link
Contributor Author

NateWr commented Aug 29, 2016

I've fixed a number of tests, but still having a JS linting issue, and the last mysql test timed out. But in the interests of time, I've gone ahead and opened PRs for the various repos.

PRS:
#1763
pkp/ojs#985
pkp/omp#330

If it's not too late for you @bozana, can you code review? Otherwise @asmecher can take over. He'll probably need to step in to work out the JS linting issue anyway...

@bozana
Copy link
Collaborator

bozana commented Aug 29, 2016

@asmecher, could you please overtake the code review for this? -- I could go roughly through, and maybe test it, but I am not so familiar with themes. But, I think I found the solution for the JS linting error... :-)

@asmecher
Copy link
Member

Thanks, @NateWr & @bozana. A few changes before it's ready to merge, @NateWr, but I don't think it'll need another review -- once you're ready, go ahead and merge. This looks really good.

@bozana
Copy link
Collaborator

bozana commented Aug 29, 2016

I knew Alec would be more helpful (than me)! :-)

@NateWr
Copy link
Contributor Author

NateWr commented Aug 30, 2016

Tests are running.

I want to do just a bit of manual testing on this tomorrow, since I had to rush through the changes, so hold off on merging if you see the tests pass.

@asmecher
Copy link
Member

if you see the tests pass

ha ha ha

@NateWr
Copy link
Contributor Author

NateWr commented Aug 31, 2016

@asmecher

OJS tests are passing!

OMP tests are failing on AclarkSubmissionTest. The OMP PR for #1528 is failing on this test as well, which makes me a bit suspicious.

@asmecher
Copy link
Member

As elsewhere, go ahead for OJS. I can run through tests locally for OMP on Friday and see what's gotten it bottled up.

NateWr added a commit that referenced this issue Aug 31, 2016
NateWr added a commit to pkp/ojs that referenced this issue Aug 31, 2016
NateWr added a commit to pkp/omp that referenced this issue Aug 31, 2016
@NateWr
Copy link
Contributor Author

NateWr commented Aug 31, 2016

Merged!

@NateWr NateWr closed this as completed Aug 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants