Editing UI of Samvera Hyrax - ruby-on-rails

I wanted to customize the UI of Samvera Hyrax application and I've built a HTML template. Now, I want to replace the old UI with the content of my HTML files, when I say it on github I found view files where I can edit the application to implement my design. But after installing I could not find any files under views. Though I found application.html.erb.
I cannot figure out where <%= yeild %> has been pointing and when I replaced all the content with my home page code. It made no changes in the hyrax working.
Thanks in advance.

Assuming you followed the Hyrax installation procedure detailed on the github wiki here, what you'll notice looking at your routes in config/routes.rb is that Hyrax is mounted as a rails engine. So using the template you didn't clone Hyrax, but you created a new rails app that uses Hyrax as an Engine. If you haven't used Engines before, it may be worth reading up on them here. This is why you don't see all the views from the Hyrax project in the application you've generated using their template.
You can override views from the Engine by creating the view in your own project in the same path as it is in Hyrax. You may want to do some additional digging to determine if this is a path you really want to go down, as it can get complicated to maintain overridden views, and there may be alternative strategies that can accomplish some of what you want to do with CSS or themeing within Hyrax. It may depend on how much you want to override and how custom a theme you are trying to achieve.

Related

Overriding the default views in RailsAdmin

I am using Ruby on Rails 4.2.1 with RailsAdmin. The gem works excellent, but I have the requirement that the layout of the admin panel and the forms must look different than what is generated by default. For example, the navigation should be horizontal top, the forms should order the fields in two columns.
So far I haven't find a way to copy the views locally and modify them (like in Devise for example). I have tried to replicate the views manually in the respective path under my views folder by copying the original views, but I got problems with the helper methods that are part of RailsAdmin not being accessible from my views.
I dug deeper and found that there is a task copy_views, it was referred to in questions for the older versions of the gem, but if I try to use it now rake rails_admin:copy_views, it is not available anymore.
Am I doing something wrong, or is there another way to do this?
You can create folders in your app
app/views/rails_admin/main for https://github.com/sferik/rails_admin/tree/master/app/views/rails_admin/main
app/views/layouts/rails_admin/ for
https://github.com/sferik/rails_admin/tree/master/app/views/layouts/rails_admin
Put modified files there. It can get a little messy and you will need to update the files if the gem changes.

Replace the default templates that Grails generates

So, i am getting started with Grails and i just started using install-templates! And it is a pretty cool stuff.
I learned that i should modify the installed templates before using generate-all, generate-views or generate-controllers.
But what i couldn't figure out (and also i couldn't find in google) is how to make the changes i have made to the template permanent. A want to make the changes i have made to be used for all the projects i create from now on.
In a nutshell, How can i change the default templates Grails generates?
You have to modify the scaffolding-X.X.X.zip at grails-X-X-X\plugins (the place you installed it) so the generate goes for all the projects.
Go to src/templates/scaffolding and edit the files.

Integrating new designs into an old rails application

I was asked to integrate new designs into an old app, but the designs are completely different from what there is now. Due to the functionalities already there in the app, I had to integrate the design into it. Starting with the homepage, I replaced all the html.erb files but there is a bootstrap theme which is consistent in the background. I also have to integrate new js into the app. Can anyone please guide a newbie through this? Been at it since 2 days and I don't even know where I am going wrong. Working with rails 3.2.13. Any suggestions or advice for the same would be very much welcome too. Thanks in advance.
P.S. Any further information/details needed, will be provided on asking.
I don't know how proficient you are with Rails, but the bottom line is this:
Rails is an MVC framework, meaning all the interface stuff is
contained in the views part of the app
When you want to change the look of the homepage, all you need to do
is go into app/views/home_controller/index.html.erb and edit te
file. That will allow you to change the HTML; the CSS is simply about
replacing / changing the app/assets/stylesheets/application.css
files
If you're trying to integrate bootstrap, I would personally:
remove all the CSS (depending on how much changing you wish to do)
add the bootstrap CSS, apply fixes to the layout files (in app/views/layouts/application.html.erb)
begin to re-design the interface for each view using boot
This is obviously very generalised. Maybe you can post some code to give us an idea as to what you're struggling with directly?
Many thanks!

Locomotive CMS with Rails - location for liquid templates

I'm new to both Ruby on Rails and Locomotive CMS, but I'm just starting to create my first site with them.
I've got the engine running in a full Rails app (I'm going to need to deploy it on our own server later on). But it's just spitting out the 'Template' content defined through the admin interface, without any other template/content around it.
I can 'fix' it by shoving the html for the whole page in through this input field. But that's not right, surely? The Getting Started guide talks of putting the templates in the filesystem, at something like: Pages/index/first page. "All pages are inherited from index". I have an index.liquid under views/pages but it's not picking that up... (I've tried a couple of other locations too).
I'm sure this is a dumb question, but please could someone tell me where to put my template in the file system? Or how to point Locomotive to pick it up from the right place?
(I did get the file system liquid template working by defining it through the Rails way, with a route, a controller and adding a liquid template initializer I found here. But then it's missing the variables that should come from the CMS content).
I'm loading the site using bundle exec unicorn_rails. And I'm using Rails v3.2.13, Ruby v1.9.3 and Locomotive_cms v2.2.2.
Thanks!
I'm Didier from LocomotiveCMS.
LocomotiveCMS is a little bit different from the other CMS, in a sense, we offer a tool named Wagon to manage your site locally without having to install mongodb, rails and some other components.
Another huge benefit is that you can write your templates in HAML and your CSS in SASS/ SCSS or Less (we embedded Compass as well) and with our preferred texts editor (editing a whole site in a browser is a nightmare).
That's a nice eco-system in order to be super efficient when it comes to develop a LocomotiveCMS site.
Once you're done with your local work, you can deploy your site to a remote LocomotiveCMS engine in a similar way you push your application to Heroku. Actually, pushing a site will create the back-office for the final end user.
I suggest you to read that page.
http://doc.locomotivecms.com/guides/get-started/requirements
and this one too
http://www.locomotivecms.com/tour
Our message is still not clear on our official website but believe me, we are working to make it better.
Hope it will help you !
Didier

Multiple Rails forks with separate designs and layouts

I have a Rails project that is basically a simple web app for a membership-based organization. We've open sourced the code on Github for the web app so that others can use it, but have a licensed design/layout that the original organization is going to use. This layout cannot be open sourced. I was wondering if others have run into the situation where you have an open-source Rails app with a non-OS design.
My initial thought is to put app/views in .gitignore, and to have anyone forking the code add their own views directory, perhaps including an app/views_default directory with a web-app-theme layout or something else to get people running. Is this the best option (realizing that there are other files such as JavaScript, CSS, etc that come with the layout that must also be ignored).
Does anyone have some good thoughts or pointers on this?
Hoopla - svn:externals for Git.
Instead of git:ignore, you can push the non-open-source stuff somewhere else, and your open-source code on github. Use hoopla to manage the externals.
http://6brand.com/git-svn-externals-rails-plugins.html
Rails Theme_Support plugin: http://github.com/aussiegeek/theme_support (There are forks as well). You can create a theme directory with multiple themes, and load the theme programmatically in ApplicationController. This would allow anyone to use the application, and simply supply their own theme in the themes directory, and would allow the project to have a "default" theme which would serve as an example.

Resources