[RUBY] [Development log ⑮] I want to add an external link or PDF link

About the premise

Nice to meet you, my name is Irifune and I go to a programming school. This article is used for my own output by writing a record of the development of personal apps, which is a school task. If anyone has read it, I would be grateful if you could give us feedback.

We will develop a "paid leave management tool". For specifications, see Past Articles.

The app will be deployed, but it is not provided as a service. Please understand that this is just a part of self-study. Then go to the main subject.

Contents of this implementation

This time, I would like to add a link from the Ministry of Health, Labor and Welfare and a PDF link to the paid leave notification. It's a bonus, isn't it? Actually, follow the procedure below.

--Implemented a link from the Ministry of Health, Labor and Welfare --Implemented to open in new tab --Google drive sharing settings --Implemented a link for paid leave notification

Implemented Ministry of Health, Labor and Welfare link

スクリーンショット 2020-05-17 19.19.29.png

Install it on the button of the related site at the bottom left of the page. This is very easy because you just enter the URL in link_to.

haml:branches/_side.html.haml


~ Omitted ~
    .links
      = link_to '#' do
Paid leave notification
      = link_to "https://www.mhlw.go.jp/shingi/2004/04/s0428-7b2a.html", class: "link" do
Related Sites

Implemented to open in new tab

When you actually click the link, you will be taken from the currently open paid leave management tool page to the Ministry of Health, Labor and Welfare page. Now that you have to press the back button each time, make sure the link is displayed in a new tab.

haml:branches/_side.html.haml


~ Omitted ~
    .links
      = link_to '#' do
Paid leave notification
      = link_to "https://www.mhlw.go.jp/shingi/2004/04/s0428-7b2a.html", target: :_blank, class: "link" do
Related Sites

I added the "target :: _ blank" part. You can now open it in a new tab. スクリーンショット 2020-05-17 19.28.07.png

google drive sharing settings

Next, implement the link for the PDF document "Annual paid leave notification". I think that many companies manage their paid leave applications on a paper basis, so if you have a sample paid leave management tool, you can immediately print it out and give it to your employees. This time, I will get the link using the sharing setting of google drive. スクリーンショット 2020-05-17 19.32.12.png First, save the PDF file in your drive. You can save it by dragging and dropping. Then right-click on the file you want to share and press "Share". There is a link at the bottom of the menu that appears, so click "Change to everyone who knows the link" and then click "Copy link". スクリーンショット 2020-05-17 19.39.17.png Referenced article "Share files on Google Drive"

Implemented paid leave notification link

Reflect the last obtained link in link_to of rails.

haml:branches/_side.html.haml


~ Omitted ~
    .links
      = link_to "https://drive.google.com/file/d/1NXmC35ZbmCOAqu7oGyCOc2LqipHDGDJj/view?usp=sharing", target: :_blank, class: "link" do
Paid leave notification
      = link_to "https://www.mhlw.go.jp/shingi/2004/04/s0428-7b2a.html", target: :_blank, class: "link" do
Related Sites

This method is easy, but since the account name and email address will be displayed in the opened link, if you want to implement it properly as a service, prepare a dedicated google account or another method may be better I don't know.

Looking back on today

The personal presentation is approaching. It has become quite a form in the sense that paid holidays are given and digested manually, but since important grant calculations etc. are omitted, I will continue to make applications after May 19th. ..

Recommended Posts

[Development log ⑮] I want to add an external link or PDF link
I want to make an ios.android app
I want to do team development remotely
I want to send an email in Java.
I want to embed any TraceId in the log
I want to add a reference type column later
I want to simplify the log output on Android
I want to add a delete function to the comment function
Add an icon to the header link using Rails fontawesome
I want to build Java Applet without using an IDE
I want to change the log output settings of UtilLoggingJdbcLogger
I want to manually send an authorization email with Devise
I want to convert characters ...
I want to convert an array to Active Record Relation with Rails
I want to hook log file generation / open with log4j # FileAppender
I want to add a browsing function with ruby on rails
I tried to build an http2 development environment with Eclipse + Tomcat
I want to add the disabled option to f.radio_button depending on the condition
I want to add devise in Rails, but I can't bundle install
[Rails] I want to add data to Params when transitioning with link_to
Swift: I want to chain arrays
I want to use FormObject well
I want to convert InputStream to String
How to insert an external library
I want to docker-compose up Next.js!
I made an app to scribble with PencilKit on a PDF file
(Limited to Java 7 or later) I want you to compare objects in Objects.equals
I want to display an error message when registering in the database
I want to ForEach an array with a Lambda expression in Java