我是rails的新手并试图在rails 4中实现一个灯箱。我的问题是如何在erb中编写以下代码?
<a href="#img1">
<img src="some_img.jpg">
</a>
<a href="#_" class="lightbox" id="img1">
<img src="some_img.jpg">
</a>
答案 0 :(得分:1)
<%= link_to image_tag("some_img.jpg"), "#img1" %>
<%= link_to image_tag("some_img.jpg"), "#_", :class => "lightbox", :id => "img1" %>
答案 1 :(得分:0)
package com.example.noti;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
// TODO Auto-generated method stub
if(intent==null||intent.getAction()==null)
return;
String action=intent.getAction();
if(action.compareTo("hello")==0)
{
Intent it= new Intent(getApplicationContext(),Constants.class);
it.setAction("hello");
PendingIntent pt=PendingIntent.getService(getApplicationContext(), 1, it, 0);
Intent it1= new Intent(getApplicationContext(),Constants.class);
it.setAction("hello1");
PendingIntent pt1=PendingIntent.getService(getApplicationContext(), 2, it1, 0);
Notification.Builder builder=new Notification.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(hello())
.setContentText("inside")
.addAction(R.drawable.pre,"",pt)
.addAction(R.drawable.next,"",pt1);
NotificationManager nm=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(1,builder.build());
handleIntent(intent);
//return super.onStartCommand(intent, flags, startId);
}
if(action.compareTo("hello1")==0)
{
Intent it= new Intent(getApplicationContext(),Constants.class);
it.setAction("hello");
PendingIntent pt=PendingIntent.getBroadcast(getApplicationContext(), 0, intent, 0);
Notification.Builder builder=new Notification.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Main")
.setContentText("inside21")
.addAction(R.drawable.pre,"",null)
.addAction(R.drawable.next,"", pt);
NotificationManager nm=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(2,builder.build());
}
}