小编Mik*_*e G的帖子

Bootstrap 3 + Rails 4 - 某些Glyphicons不工作

我想在我的rails 4 app中使用bootstrap 3.按照教程使用 github页面中的bootstrap saas设置bootstrap 3 .

Bootstrap工作正常,但glyphicons没有按预期工作.

某些字形根本没有显示.例如,我厌倦了在application.html.erb中显示其中一些进行测试:

glyphicon glyphicon-floppy-disk -> <span class="glyphicon glyphicon-floppy-disk"></span>
</br>
glyphicon glyphicon-plus -> <span class="glyphicon glyphicon-plus"></span>
</br>
glyphicon glyphicon-minus -> <span class="glyphicon glyphicon-minus"></span> 
Run Code Online (Sandbox Code Playgroud)

图标呈现像这样

软盘图标根本不呈现(显示无效的字符)加号和减号sig不是粗体,比bootstap网站上显示的要小得多.

我也在rails控制台上看到以下消息.

Started GET "/fonts/glyphicons-halflings-regular.woff" for 127.0.0.1 at 2014-02-22 16:29:54 -0800
ActionController::RoutingError (No route matches [GET] "/fonts/glyphicons-halflings-regular.woff"):

Started GET "/fonts/glyphicons-halflings-regular.ttf" for 127.0.0.1 at 2014-02-22 16:29:54 -0800
ActionController::RoutingError (No route matches [GET] "/fonts/glyphicons-halflings-regular.ttf"):

Started GET "/fonts/glyphicons-halflings-regular.svg" for 127.0.0.1 at 2014-02-22 16:29:54 -0800
ActionController::RoutingError (No route matches …
Run Code Online (Sandbox Code Playgroud)

twitter-bootstrap-rails ruby-on-rails-4 twitter-bootstrap-3

36
推荐指数
5
解决办法
3万
查看次数

spring mvc 3动态列表绑定+ jquery + AJAX

我在Spring中面临动态列表绑定的问题.我正在尝试创建一个"添加联系人"页面,其基本上如下所示:

联系表格http://i47.tinypic.com/345g50h.png

当点击"添加电话"按钮时,我想在下面显示另一个"电话类型"和"电话号码"按钮,以便用户可以输入多个电话号码.这是我面临问题的地方.

以下是我的代码:

域类 - 联系方式:

在我的表单中,名字,姓氏,电子邮件和生日是域类"联系人"的实例变量,以及列表电话部分的电话类型和电话号码.

    @Entity
    @Table(name = "CONTACTS_JPA2")
    public class Contact {

    @Id
    @Column(name = "CONTACT_ID")
    @GeneratedValue
    private int Id;

    @Column(name = "FIRST_NAME")
    private String firstname;

    @Column(name = "LAST_NAME")
    private String lastname;

    @SuppressWarnings("unchecked") 
    @OneToMany(mappedBy = "contact", cascade = CascadeType.ALL)
    private List<Phone> phones = LazyList.decorate(new ArrayList<Phone>(),FactoryUtils.instantiateFactory(Phone.class));

    @Column(name = "EMAIL_ID")
    private String emailid;

    @Column(name = "BIRTHDAY")
    private Date birthday;

        /*Getters and Setters*/

    }
Run Code Online (Sandbox Code Playgroud)

课程电话:

    @Entity
    @Table(name = "PHONE")
    public class Phone {

    @Id
     @Column(name = "ID")
     private int …
Run Code Online (Sandbox Code Playgroud)

javascript jquery spring spring-mvc

6
推荐指数
1
解决办法
1万
查看次数

ios - 以编程方式将文本字段添加到uitableviewcell不起作用

新秀ios的问题.我正在尝试使用表视图控制器创建一个注册表单.我正在尝试在cellForRowAtIndexPath方法中以编程方式向每个单元格添加文本字段,但我的所有文本字段似乎都在第一个单元格上创建 - 一个与另一个单元格重叠.这是我的代码.

这是我的细胞渲染方式.我认为我正在做一些愚蠢的事情,重复使用细胞.我确实在stackoverflow上检查了一些其他类似的线程,但没有一个帮助.你能告诉我我错过了什么,或者这是否应该是这样做的.您的意见非常感谢.

谢谢,迈克

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"signUpFields" forIndexPath:indexPath];

// Configure the cell...
if (indexPath.row == 0){
    //self.firstName = [[UITextField alloc] initWithFrame:CGRectMake(5, 0, 280, 21)];
    self.firstName = [[UITextField alloc] initWithFrame:CGRectMake(120, 13, 375, 30)];
    self.firstName.placeholder = @"First Name";
    self.firstName.autocorrectionType = UITextAutocorrectionTypeNo;
    [self.firstName setClearButtonMode:UITextFieldViewModeWhileEditing];
    //cell.accessoryView = self.firstName;
    [cell.contentView addSubview:self.firstName];
}

if (indexPath.row == 1){
    self.lastName = [[UITextField alloc] initWithFrame:CGRectMake(120, 13, 375, 30)];
    self.lastName.placeholder = @"Last Name";
    self.lastName.autocorrectionType = UITextAutocorrectionTypeNo;
    [self.lastName setClearButtonMode:UITextFieldViewModeWhileEditing];
    //cell.accessoryView = self.lastName; …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview uitextfield ios

4
推荐指数
1
解决办法
3万
查看次数

Rails 4多对多关联不起作用

Ruby on rails新手在这里.试图创建一个入门博客应用程序,并在我的模型之间的多对多关联中遇到问题.

我有2个模型 - 帖子,类别,彼此之间有多对多关联.

我的问题:当我创建一个新帖子时,Post会被保存,但是类别后关联不会保存在categories_posts表中.

我的代码如下.

感谢您对此的投入.

post.rb

class Post < ActiveRecord::Base
  validates_presence_of :title, :body, :publish_date
  belongs_to :user
  has_and_belongs_to_many :categories
end
Run Code Online (Sandbox Code Playgroud)

category.rb

class Category < ActiveRecord::Base
  validates_presence_of :name
  has_and_belongs_to_many :posts
end
Run Code Online (Sandbox Code Playgroud)

categories_posts.rb

class CategoriesPosts < ActiveRecord::Base
end
Run Code Online (Sandbox Code Playgroud)

迁移 - create_posts.rb

class CreatePosts < ActiveRecord::Migration
  def change
    create_table :posts do |t|
     t.string :title
     t.text :body
     t.date :publish_date
     t.integer :user_id

     t.timestamps
    end
  end
end 
Run Code Online (Sandbox Code Playgroud)

迁移 - create_categories.rb

class CreateCategories < ActiveRecord::Migration
  def change
    create_table :categories do |t|
      t.string :name
      t.timestamps …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails associations has-and-belongs-to-many ruby-on-rails-4

4
推荐指数
1
解决办法
8459
查看次数

带文本字段的UiTableView - 键盘出现时滚动

我正在tableview控制器中创建一个带有textfields的表单.在输入字段值后按下返回键时,我试图在这里实现两件事:

1)将光标移动到下一个字段2)向上滚动表格视图

我的代码正在将光标移动到下一个字段,但滚动部分不起作用.你能让我知道我在这里失踪了吗?我研究了堆栈溢出的类似问题,并且遵循他们的建议,但仍面临问题.感谢您的意见.

- (BOOL)textFieldShouldReturn:(UITextField *)textField{

    if ([textField isEqual:self.firstName]){
    //Move cursor to next field
    [self.lastName becomeFirstResponder];

    //scroll    
    id cellContainingFirstResponder = textField.superview.superview ;
    NSIndexPath *currentRowIndexPath = [self.signUpTable indexPathForCell:cellContainingFirstResponder];
    NSIndexPath *nextRowIndexPath = [NSIndexPath indexPathForRow:currentRowIndexPath.row+1 inSection:currentRowIndexPath.section];
    [self.signUpTable scrollToRowAtIndexPath:nextRowIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
}

if ([textField isEqual:self.lastName]){
    //Move cursor to next field
    [self.emailId becomeFirstResponder];

    //scroll
    id cellContainingFirstResponder = textField.superview.superview ;
    NSIndexPath *currentRowIndexPath = [self.signUpTable indexPathForCell:cellContainingFirstResponder];
    NSIndexPath *nextRowIndexPath = [NSIndexPath indexPathForRow:currentRowIndexPath.row+1 inSection:currentRowIndexPath.section];
    [self.signUpTable scrollToRowAtIndexPath:nextRowIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
}

if ([textField isEqual:self.emailId]){

    //Move cursor to next field
    [self.phoneNumber becomeFirstResponder]; …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview ios

0
推荐指数
1
解决办法
7735
查看次数