Ransack sort_link How to change the color!

How to change the color using css by specifying the class with Ransack sort_link

For sorting implementation in ransack, refer to the following URL Let's make a search function with Ruby on Rails (ransack)

State before change

スクリーンショット 2020-12-14 8.34.07.png

State after change

スクリーンショット 2020-12-14 8.34.18.png

In the above image, the retweet number sort part Change the default blue to black!

index.html.erb

<%= sort_link(@q, :tweet_created_at, "Post date and time" ,{ default_order: :desc }, { class: "Editlink" }) %>

application.scss

//Erase the link
.Editlink {
  text-decoration: none;
  color: #272343;
  &:link {
    text-decoration: none;
    color: #272343;
  }

  &:visited {
    text-decoration: none;
    color: #272343;
  }

  &:hover {
    text-decoration: none;
    color: #272343;
  }

  &:active {
    text-decoration: none;
    color: #272343;
  }

}

<% = sort_link (@q, column name to sort," characters to display in link ", {specify how to sort}, {Html option})%> If you specify class and id in the html option part of this writing, you can customize sort_link as you like using css!

Recommended Posts

Ransack sort_link How to change the color!
How to change the timezone on Ubuntu
http: // localhost: How to change the port number
[swift5] How to change the color of TabBar or the color of item of TabBar with code
How to change the action with multiple submit buttons
[Ruby on Rails] How to change the column name
[Rails] How to change the column name of the table
Git How to easily return to the state before the change (before commit)
How to change the setting value of Springboot Hikari CP
How to change the contents of the jar file without decompressing
How to change the file name with Xcode (Refactor Rename)
How to use the link_to method
How to use the include? method
How to find the average angle
How to use the wrapper class
How to change kube-proxy to ipvs mode.
How to add the delete function
How to change from HTML to Haml
[Swift] How to dynamically change the height of the toolbar on the keyboard
[Rails] How to introduce kaminari with Slim and change the design
[Rails] How to change the page title of the browser for each page
[chown] How to change the owner of a file or directory
[Rails 5] How to display the password change screen when using devise
How to change app name in rails
[Java] How to use the File class
How to delete the wrong migration file
[Java] How to use the hasNext function
How to put out the error bundling
[Java] How to use the HashMap class
How to delete the migration file NO FILE
[Rails] How to use the map method
[Eclipse] Change the color of the vertical ruler
[Java] How to use the toString () method
Studying how to use the constructor (java)
[Processing × Java] How to use the loop
How to determine the number of parallels
Bootstrap4 Change the color of the hamburger menu
[Java] How to set the Date time to 00:00:00
[Java] How to get the current directory
[Swift] How to implement the countdown function
[Processing × Java] How to use the class
How to sort the List of SelectItem
How to install the legacy version [Java]
How to find the tens and ones
How to pass the value to another screen
How to get the date in java
[Processing × Java] How to use the function
[Swift] Change the color of SCN Node
[Java] Color the standard output to the terminal
[Java] How to use the Calendar class
Summarized how to climb the programming stairs
How to change the value of a variable at a breakpoint in intelliJ
[Rails] How to create a table, add a column, and change the column type
How to find the cause of the Ruby error
How to use the camera module OV7725 (ESP32-WROVER-B)
How to check the logs in the Docker container
[Java] How to use Thread.sleep to pause the program
Customize how to divide the contents of Recyclerview
How to color code console output in Eclipse
[Rails] How to use select boxes in Ransack
[Android] How to detect volume change (= volume button press)