小编bra*_*r19的帖子

Rails设计宝石和模态窗口

你能给我一个很好的教程,将静态设计登录/注册更改为基于ajax的模态窗口吗?现在我像模态一样完成它,但它不是ajax.另外在"google"中有教程,但它们仅用于登录.但我需要使用ajax登录,并且!模态窗口.有没有很好的教程,建议等?在互联网上找不到好的.登录一切正常,我看到你的代码......但如何以这种方式注册?在网上有什么......

ajax ruby-on-rails modal-dialog devise

5
推荐指数
1
解决办法
2077
查看次数

Watir打开多个浏览器或选项卡

如何使用我的code-watir打开多个浏览器,例如通过while0到10 的循环?

这是我的代码:

require 'watir-webdriver'
require 'headless'
class Page
    @headless = Headless.new
    @headless.start
    @browser = Watir::Browser.start 'bit.ly/***'
    def self.get_connection

        puts "Browser started"  
        puts @browser.title
        @browser.driver.manage.timeouts.implicit_wait = 3 #3 seconds

        @browser.select_list(:name => 'ctl00$tresc$111').select_value('6')
        puts "Selected country"  
        @browser.select_list(:name => 'ctl00$tresc$222').wait_until_present
        @browser.select_list(:name => 'ctl00$tresc$333').select_value('95')
        puts "Selected city" 
    end

    def self.close_connection
        @browser.close
        @headless.destroy
    end
end

Page.get_connection
Page.close_connection
Run Code Online (Sandbox Code Playgroud)

但是怎么做这样的事呢?

while i < 10
Page.get_connection
end
Run Code Online (Sandbox Code Playgroud)

ruby watir watir-webdriver

5
推荐指数
1
解决办法
1865
查看次数

Rails访问公用文件夹中的文件夹

我有这样的结构(例如):

 public
   art_im
     folder1
        img01.jpg
Run Code Online (Sandbox Code Playgroud)

我需要写什么,在标签中访问这个img01.jpg?我试试

= image_tag("#{Rails.root}/public/art_im/images_#{@graphics.id}/#{@grp.id}.jpg", :alt => "#{@art.nr}")
Run Code Online (Sandbox Code Playgroud)

但我得到了HTML <img alt="lalala" src="/home/prog/project/Shop/public/art_im/images_32/214800.jpg">

但如何在我的服务器上链接,并获得此图像?

ruby-on-rails

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

Rails在视图中设置页面标题

如何在某些视图中设置页面标题,如果未设置,则使用默认标题?
我用HAML.做正确的方法是什么?

现在我喜欢:

- content_for :title, "Title for specific page"
Run Code Online (Sandbox Code Playgroud)

并在布局中:

%title= h yield(:title)
Run Code Online (Sandbox Code Playgroud)

但是如何设置这个标题,但如果它不存在,设置一些默认值?

haml ruby-on-rails

5
推荐指数
1
解决办法
2049
查看次数

WP即页脚不在底部

我有一个麻烦,诺基亚lumia 520,即我没有我的页脚在页面的底部,但在其他ios,Android设备都没关系.

为什么在"移动",即我有这样的麻烦?

<div class="page-wrap"> 
</div>
<footer>
</footer>
Run Code Online (Sandbox Code Playgroud)

和css:

html, body{
  height: 100%;
  min-height: 100%;
}

.page-wrap{
  min-height: 100%;
  margin-bottom: -70px;
  overflow: auto;
  background: green;
}

.page-wrap:after{
  content: "";
  display: block;
}

footer{
  width: 100%;
  height: 50px;
  padding: 20px 0 0 0;
  background: #577abd;
}

@-ms-viewport{width:auto!important;height:320px!important}  //or even without this line
Run Code Online (Sandbox Code Playgroud)

小提琴:

http://jsfiddle.net/pmp01rt4/

html css internet-explorer windows-phone-8

5
推荐指数
0
解决办法
267
查看次数

Javascript(angularJS):按多个字段过滤

例如,我有这样的列表(我使用ng-repeat):

var myList = [
  {id: 1, name: 'Peter Ollison', type: 'Driver', status: 'Working'},
  {id: 2, name: 'Maya Nameson', type: 'Manager', status: 'Not'},
  {id: 3, name: 'Iki Jonny', type: 'Driver', status: 'Paused'},
  {id: 4, name: 'Nikolay Ivanov', type: 'Manager', status: 'Working'},
  {id: 5, name: 'Nikolay Ivanov', type: 'Sales manager', status: 'Not'},
  {id: 6, name: 'Scotty Deperson', type: 'Boss', status: 'Working'},
]
Run Code Online (Sandbox Code Playgroud)

我有过滤器数组:

nameFilter: ['Peter Ollison', 'Nikolay Ivanov']
typeFilter: ['Manager', 'Driver']
statusFilter: ['Working']
Run Code Online (Sandbox Code Playgroud)

如何在滤波器功能中结合所有这些滤波器?并且只返回列表中的这些项,它们等于过滤器数组?但!!!我可以有:

仅按名称过滤,或仅按类型,或2个字段或全部过滤

怎么可以过滤我的清单?

例如,如果我一次过滤3个过滤器阵列,我应该得到结果:

[{id: 1, name: 'Peter …
Run Code Online (Sandbox Code Playgroud)

javascript filter angularjs

5
推荐指数
1
解决办法
123
查看次数

Angular 2:使用来自http的数据填充FormBuilder

我从组件中的rjsx获取我的数据(让我们命名customer).

然后我在客户中使用内部组件:

<customer>
  <customer-form [customer]="customer"></customer-form>
</customer>



<!-- [customer]="customer" // here is data from http -->
Run Code Online (Sandbox Code Playgroud)

在客户形式我有:

@Input() customer:ICustomer;

complexForm : FormGroup;



constructor(fb: FormBuilder) {

  this.complexForm = fb.group({
    'name': [this.customer['name'], Validators.compose([Validators.required, Validators.minLength(3), Validators.maxLength(255)])]
  });
}
Run Code Online (Sandbox Code Playgroud)

但我得到:

Cannot read property 'name' of undefined
TypeError: Cannot read property 'name' of undefined
Run Code Online (Sandbox Code Playgroud)

如果我理解正确:这是因为构造函数被调用,但数据尚未从http获取,因此customer是空的.但是如何解决这个问题?

upd:我的http数据得到:

   getCustomer(id) {
    this.customerService.getCustomer(id)
      .subscribe(
        customer => this.customer = customer,
        error =>  this.errorMessage = <any>error);
  }
  ----


@Injectable()
export class CustomerService {

  private customersUrl = 'api/customer'; …
Run Code Online (Sandbox Code Playgroud)

javascript http rxjs angular

5
推荐指数
2
解决办法
4179
查看次数

Redux:dispatch(...).then 不是一个函数

我有这样的action

import { GET, POST, PUT, REMOVE } from "../../Utils/Http";

export const FETCH_ARTICLES = "FETCH_ARTICLES";
export const FETCH_ARTICLES_SUCCESS = "FETCH_ARTICLES_SUCCESS";
export const FETCH_ARTICLES_FAILURE = "FETCH_ARTICLES_FAILURE";
export const RESET_ARTICLES = "RESET_ARTICLES";


export function fetchArticles() {
  const request = GET("/articles");

  return {
    type: FETCH_ARTICLES,
    payload: request
  };
}

export function fetchArticlesSuccess(articles) {
  return {
    type: FETCH_ARTICLES_SUCCESS,
    payload: articles
  };
}

export function fetchArticlesFailure(error) {
  return {
    type: FETCH_ARTICLES_FAILURE,
    payload: error
  };
}
Run Code Online (Sandbox Code Playgroud)

reducer

import {
  FETCH_ARTICLES,
  FETCH_ARTICLES_SUCCESS,
  FETCH_ARTICLES_FAILURE, …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs redux react-redux

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

Css设置左固定和右流体布局

我需要用html和css这样的布局:左边宽度是静态的250px右边是流畅的,其他剩余的屏幕(100%-250px)

我试试(我正在使用sass):

  .wrapper{
    width:100%;
    margin: 0 auto;
    .left{
      width:250px;
      float:left;
    }
    .right{
      float:right;
      width:100%;
      margin-left: 250px;
    }
  }
Run Code Online (Sandbox Code Playgroud)

那么我该如何解决这个问题呢?

html css sass

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

java.lang.noclassdeffounderror:com.google.android.gms.R $ styleable没什么帮助我的

我有这样的活动类代码:

package com.pavel.exchanger;

import android.os.Bundle;
import android.app.Activity;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import android.support.v4.app.Fragment;


public class SearchExchangerActivity extends FragmentActivity   {
    static final LatLng HAMBURG = new LatLng(53.558, 9.927);
    static final LatLng KIEL = new LatLng(53.551, 9.993);
    private GoogleMap map;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search_exchanger);

        map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                .getMap();
            Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG)
                .title("Hamburg"));
            Marker kiel = map.addMarker(new MarkerOptions()
                .position(KIEL)
                .title("Kiel") …
Run Code Online (Sandbox Code Playgroud)

java android dalvik

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