iloire / asp.net-mvc-example-invoicing-app

Example invoicing application in ASP.NET MVC3
224 stars 208 forks source link

jQuery is not reusable. #8

Closed p10tyr closed 12 years ago

p10tyr commented 12 years ago

I think that you need to create a core JavaScript file.

This is going to take some remodelling to allow re usability for buttons like.

$('a.newCustomer').live('click', function () {

to be used on any page.

For example when I click proposal. It is obvious its for new customer. So I quickly want to add him.

I do not want to go edit customer... then proposal

This file should be loaded in Shared

any specific jQuery that only applies to ONE page should be loaded on that view - like UI effects, graphs or something.

iloire commented 12 years ago

Hi there!

Yes, I know, there are always lots of ways to improve things, and sometimes a few time to do it... Feel free to send a pull request with those changes and I will merge :)

Thanks,

iván

p10tyr commented 12 years ago

HI,

Yes I would like to make some changes. I am not all that sure how to do it though?

I have added support to attach files to an invoice - stores file in database as blob in sql 2008.

I have been working with some of the javascript and there is allot of un necessary script

for example

$('a.newFileUplaod').live('click', function () { clearErrors();

          var id = $(this).attr("idInvoice");
          var url = '@Url.Content("~/DataStorage/UploadPartial")/' + id;

          getRequest(url);

          return false;
      });

can simply be

$('a.newFileUplaod').live('click', function () { clearErrors();

          getRequest(getRequest($(this).attr('href')););

          return false;
      });

Because it is already have an href generated from MCV- also remove the invoiceID property- that is bad taging any way. you should use data-invoiceID then you can use jquery.data("invoiceID") - it is in guidelines with HTML5

Besides- Using A href and the returning false is very bad code practice.

I will be working on this form time to time because I will use it for my own personal needs. I like the desing and I am happy it is in MVC3 so its easy to code.

Please let me know how I can update the code. Do i need to install something and then downlaod the source control and update it back somehow- like team explorer or source safe?

On 4 August 2012 01:35, Iván Loire < reply@reply.github.com

wrote:

Hi there!

Yes, I know, there are always lots of ways to improve things, and sometimes a few time to do it... Feel free to send a pull request with those changes and I will merge :)

Thanks,

iván


Reply to this email directly or view it on GitHub:

https://github.com/iloire/ASP.NET-MVC-ACME-Invoicing--App/issues/8#issuecomment-7497785