当前,当患者填写他们要求医生签名的表格时,我有一个通知系统。医生得到成功的通知。但是我要寻找的是当医生收到通知时,他们可以单击该通知(link_to)并自动重定向到该表格。
<% if @notifications.count > 0 %>
<ul>
<% @notifications.each do |notification| %>
<li>
<span class="notification-title"><%= notification.title %></span>
<span class="notification-message"><%= notification.message %></span>
<span class="notification-time"><%= notification.created_at.strftime("%B %e at %l:%m%P") %></span>
</li>
<% end %>
</ul>
<div class="notifications-preview-footer">
<%= link_to "See All", notifications_path %>
</div>
<% else %>
<ul>
<li>No Notifications</li>
</ul>
<% end %>
答案 0 :(得分:1)
我使用link_to示例更改了标题范围,因此,如果单击标题,它将转到通知显示页面
Private Sub ComboBox2_Change()
Dim index As Integer
'list ComboBox2 and look for dependency
index = ComboBox2.ListIndex
ComboBox3.Clear
Dim whichName as String
Select Case index
Case "A Class": whichName = "aClass" 'assumed named range scoped to worksheet
Case "B Class": whichName = "bClass" 'assumed named range scoped to worksheet
End Select
ComboBox3.List = Worksheets("LookupLists").Range(whichName).Value
End Sub
答案 1 :(得分:0)
这里有很多未知数,首先,您的route.rb文件需要定义路由以允许这样说
# config/routes.rb
resources: notifications
然后您需要为视图定义控制器动作,例如显示/编辑?
# notifications_controller.rb
class NotificationsController < ApplicationController
def show
@notification = Notification.find(params[:id])
end
end
然后您可以像上面一样修改视图,以允许链接到每个通知
<% @notifications.each do |notification| %>
<li>
<%= link_to <span class="notification-title"><%= notification.title %></span>, notification_path(notification) %>
<span class="notification-message"><%= notification.message %></span>
<span class="notification-time"><%= notification.created_at.strftime("%B %e at %l:%m%P") %></span>
</li>
<% end %>
这可能会为您提供所需的东西。