I am seeking for tested date & time picker that just works with active admin 0.5.0.
I am digging for hours now, I've read dozens of existing discussions on stackoverflow and many other resources found in the net.
I've encountered problems with virtually any datetime picker script. For instance, activeadmin's wiki page Combine datetime picker with active_admin no longer apply to 0.5.0. Result looks like this.
Some of them suffer from CSS inheritance - active admin applies a lot of styling, and if picker's author had not avoided that, it requires manually styling indefinite amount of CSS properties just to revert changes.
I cannot rely on such scripts. It is not because I am lazy, or I am unable to fix them. There's just too big risk of breaking such hacks in case of updating any of dependent gems/libraries related to active admin.
Anyone can recommend working solution that won't suffer from such problems?
I've just created a gem for that:
https://github.com/saepia/just-datetime-picker
Checkout the DateNTimePickerActiveAdmin Rubygem. It works really well and is customisable according to your project.
You can find the documentation here: https://github.com/NikhithaGraceJosh/date_n_time_picker_activeadmin
From the docs:
Gemfile
gem 'date_n_time_picker_activeadmin'
Code Sample (In your form)
f.input :column_name, as: :datetimepicker
CSS
In active_admin.scss, add the line,
#import date_n_time_picker_activeadmin
JS
In active_admin.js, add the line,
//= require date_n_time_picker_activeadmin
Hope it's useful!
just-datetime-picker gem doesn't seem to be maintained since last year, so better to use pickadate-rails gem.
Checkout this Integrating datepicker and timepicker with active admin
Related
I have successfully installed the meta-tags gem for Rails and verified it.
Now, I am not sure how to modify my model/view/controller files to make use of the meta-tags gem. Specifically, I have an app with a Product model and 2 static Pages. I am trying to take strings from the Product db and dynamically populate the meta tags for Product view pages with those values. Then, I'd like to also set meta tags for the 2 static Pages.
Specifically, after adding
<%= display_meta_tags site: 'sitename' %>
I get the following error in localhost
undefined method `display_meta_tags'
I'm not sure where to set the meta tags and exactly what syntax to use in those files. I guessed it was the controller file for setting variables, but various trials of this haven't resulted in fixing the issue. I may, however, not have the correct syntax.
I tried searching, reading the meta-tags usage section, and reading this question, but neither had enough detail as far as where to put the various statements into my own m/v/c files. In addition, other blog posts show people using various workarounds to declare their variables more efficiently and I'm not sure which consistent set up to use.
I'm new to Rails, so apologies if I have overlooked something obvious. Thanks!
Resolved. Turns out I needed to restart my rails server. I figured this out by searching things related to 'undefined gem methods' and got this question --> Using Gems with Ruby On Rails: Undefined method?
Working through Hartl's sample_app tutorial...not an issue with the tutorial, but with my own tinkering. Wondering if someone smarter than me can help us all out... I know that often times updating gems can bork your app(s), so I was prepared for this (hooray for committing often!), but when I saw that the bootstrap-sass gem I was using was out-of-date, I had to update.
Before the update, I was using v2.3.2.0 - no ill side effects.
After the update, the gem version was 3.0.2.1 and certain sass variables had changed, which was an easy fix (namely cameCase to non-camel-case). This was easily identified and fixed by running the rspec tests written to this point in the tutorial.
What's throwing me through the loop is now the right top menu links (home, help, sign in) look stacked like a "normal" un-styled un-ordered list. Correspondingly, this is causing the top bar to triple in size, and thus cover some of the text seen in the main content area.
I'm not a talented enough front-end guy to know exactly what is going on, but have tried to describe it as best as I can here. I can point you to the git commit compare here, but even this is a lot to take in.
In the meantime, I've reverted to v2.3.2.0 and all is back to how it was. Lesson learned, sniff out changes and test-test-test before blindly updating gems.
Thanks in advance for any and all help!
P.S. I also have posted this in the /r/Learn_Rails subreddit here.
For a list of what is different between BS 2.x and 3.x see this link: http://getbootstrap.com/getting-started/#migration
If you want to use the latest BS version, you'll have to update the HTML to reflect the new class names etc.
This is happening because of the new functionality introduced in the newer version of Bootstrap(3.0) and tutorial is based on the bootstrap verison(2.3..).
So, If you are interested then see the changes made in the newer versions Click Here
My CkEditor look like see image
Can you help me please...
I want to display ckeditor like on http://ckeditor.com/demo
This issue is in active admin. I want to use ckeditor on active admin.
My Active Admin version is = 0.6.0
This issue is related to a change in Active Admin CSS style described in this issue:
https://github.com/gregbell/active_admin/issues/1852
There is also a pull request awaiting merging: https://github.com/gregbell/active_admin/pull/1952
For temporary fix i'm using my cloned version with this diff applied:
gem 'activeadmin', :git => "git#github.com:kars7e/active_admin.git"
The offending CSS is the reset style which unfortunately has higher importance than CKEditor styles.
EDIT:
The maintainers of original repo have merged the fix and it's working correctly.
probably something is missing, try inspect element( chrome browser) and reload the page,see if there is some error where something is not loaded because you got the thing, just styling is incorrect.
Had the same issue, code in following wiki page helped a little....
https://github.com/gregbell/active_admin/wiki/Ckeditor-integration
You can use this fix: https://gist.github.com/SebAshton/4690552 (it worked well for me)
I'm starting research on what I'd need in order to build a user-level plugin system (like Wordpress plugins) for a Rails app, so I'd appreciate some general pointers/advice. By user-level plugin I mean a package a user can extract into a folder and have it show up on an admin interface, allowing them to add some extra configuration and then activate it.
What is the best way to go about doing this? Is there any other opensource project that does this already? What does Rails itself already offer for programmer-level plugins that could be leveraged? Any Rails plugins that could help me with this?
A plugin would have to be able to:
run its own migrations (with this? it's undocumented)
have access to my models (plugins already do)
have entry points for adding content to views (can be done with content_for and yield)
replace entire views or partials (how?)
provide its own admin and user-facing views (how?)
create its own routes (or maybe just announce its presence and let me create the routes for it, to avoid plugins stepping on each other's toes)
Anything else I'm missing?
Also, is there a way to limit which tables/actions the plugin has access to concerning migrations and models, and also limit their access to routes (maybe letting them include, but not remove routes)?
P.S.: I'll try to keep this updated, compiling stuff I figure out and relevant answers so as to have a sort of guide for others.
You might want to check out mephisto, it's a blogging software built with ruby on rails and has add-on plugin support. Not sure if it works how you are thinking of, but might give you some good insights. The source can be found on GitHub.
You should look at deface gem. It allows to customize rails views, adding content via hooks and replacing whole views/partials. Spree is using this gem so you can look also at spree. Beside views they also have other solutions for customizing application so you can find more answers to your questions.
I'm wondering if there's an integrated solution to have a database with versioned records supported by rails (ala version_fu ar_versioned) and a differ thanks!
Check out acts_as_versioned.
Thanks srboisvert for mentioning my fork. Here's a bit more info/context. The updated_attributes column's value is set for each version, and lists what attributes were changed from the prior version. This is useful when you need to display a record/version and want to show what values changed. I needed this to implement a history view for a particular record we had, where we wanted to color any changed values red in each version we displayed in the history. This is covered in my blog post which is linked above, along with a couple other minor tweaks.
If anyone tweaks it further, please do send me a pull request, etc.
As you noted, that functionality is supported in plugins, and won't be supported by Rails core.
There is a forked version of acts-as-versioned (ar-versioned) that includes an additional column in the versioned table (updated-attributes) that is a hash of what was changed.
I ended up using acts_as_audited to accomplish this along with the htmldiff plugin to get some pretty output.
see: diff a ruby string or array